I am getting these error can someone help?

subscript requires array or pointer type -- point to lowest[x] = lowest;

subscript requires array or pointer type -- average[x] = average;

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;



void studentName(string name[4]);
void getScores(double grades[4][5]);
void findLowest(double grades[4][5], double average[4], double lowest[4]);
//void calcAverage(double average[4], double grades[4][5], double lowest[4]);
//void display(string name[4], double grades[4][5], double lowest[4], double average[4]);

int main ()
{
	int count = 0;
	string name[4];
	//string letter;
	double grades[4][5];
	double lowest[4];
	double average [4];
	

	studentName(name);
	getScores(grades);
	findLowest(grades, average, lowest);
	//calcAverage(average, grades, lowest);
	//display(name, grades, lowest, average);

	cin.ignore();


	cout << "\n\n";
	return 0;
}

void studentName(string name[4])
{
	for(int x = 0; x  < 5; x++)
	{
		cout << "Please enter the name of the student: ";
		getline(cin, name[x]);
	}
}

void getScores(double grades[4][5])
{
	
	for (int x = 0; x < 5; x++)
	{
		for (int y = 0; y < 5; y++)
		{
			cout << "Please enter grade " << y + 1  << ":";
			cin >> grades[x][y];
			while (grades[x][y] < 0  || grades [x][y] > 100)
			{
				cout << "Error. Please re-enter grade: ";
				cin >> grades[x][y];
			}
		}
		
	}
}

void findLowest(double grades[4][5], double average[4], double lowest[4])
{
	for (int x = 0; x < 4; x++)
	{
		
		double lowest;//declare a variable here to hold the lowest score
		lowest = grades[x][0];
		for(int y = 0; y < 5; y++)
		{
			 //makes the new variable equal to the first element in the row

		if (grades[x][y] < lowest)
		{
					
			lowest = grades[x][y]; //swaps the value of the new variable, if needed
		}
		}

		lowest[x] = lowest; // puts value of the lowest variable into the lowest[4] array
	}
}
/*void calcAverage(double average[4], double grades[4][5], double lowest[4])
{
	double total; //total doesn't need to be an array. it is just a temp. variable.
	for(int x =0; x < 4; x++)
	{
		for(int y = 0; y < 5; y++)
		{
			total = 0; //initialize total to 0
			total += grades[x][y]; //add each element of each column to the total of the "xth row" (goes through 5 times, once for each col)
		}
		total = total - lowest[x]; //subtract the lowest score from the total using the lowest[4] array)
		
		double average;
		average = total/4; //calculates the average of the 4 highest scores
		average[x] = average; //puts value of average in new average[4] array
	}
}
*/
void display(string name[4], double grades[4][5], double lowest[4], double average[4])
{
	cout << setw(8) << "Name         Grade 1    Grade 2  Grade 3  Grade 4  Grade 5  Average\n";
	for(int x = 0; x < 4; x++)
	{
		cout << name[x] << "          ";
		for(int y = 0; y < 5; y++)
		{
			cout << grades[x][y] << "          ";
		}
		cout << average[x];
	}
}

Dont use same variable names. It makes it confusing to you and creates bugs that are very hard to find.

void findLowest(double grades[4][5], double average[4], double lowest[4])
{
	for (int x = 0; x < 4; x++)
	{
		
		double low;//declare a variable here to hold the lowest score
		low= grades[x][0];
		for(int y = 0; y < 5; y++)
		{
			 //makes the new variable equal to the first element in the row

			if (grades[x][y] < low)
			{
						
				low= grades[x][y]; //swaps the value of the new variable, if needed
			}
		}


	
			lowest[x] = low; // puts value of the lowest variable into the lowest[4] array
	
	}
}

Edit : Similar for the line where you use a variable called

average

.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.