ok my program reads data from a txt file and it displays the test scores and the sum of the scores, and it also shows the max and min from the scores , so far only one number shows up from the scores instead 10 and i think my sum is wrong too, but i cant get the max and min to work
cout << "Enter the name of your input file : ";
cin >> InFileName;
infile.open(InFileName.c_str());
if (!infile)
{
cout << "I can't find your input file" << endl;
exit(-1);
}
}
void getData(ifstream &infile, int scores[] , int &size)
{
int i = 0;
do
{
infile >> scores[i];
i++;
} while (infile);
size = i - 1;
}
double calcsum(int scores[], int size)
{
double sum = 0;
for (int i = 0; i < size; i++)
sum += scores[i];
return sum;
}
void getMax(int scores[])
{
double max = 0;
for (i = 1; i < scores; i++)
if (scores[i] > max)
max = scores[i];
its working but now im getting more errors, when i try to display max i write
cout << " you High Score is " (<<) (its gives me an error here it says no operater match these operands) max << endl;
yea, unless you see something wrong, i have a sample program that reads the data from file and displays , and basically its the same code as mine .so i have no clue