Expert Help please

Can anybody help me correct this program ? there are 6 errors in this programs, i use my dev run and know the errors but i just dont know how to correct it.


// Debug Program -- there are 6 errors in this program
// Correct this program

#include <iostream>
#include <iomanip>


using namespace std;

void readData(ifstream& inputFile, int list[], int size);
void holdscrn( ); // void function to hold screen open before exit


int main()
{
int scores[8] = {0};

ifstream infile;

infile.open("TestScoresData.txt");

if (infile)
{
cout << "Cannot open the input file. Program terminates!"
<< endl;
holdscrn( ); // Hold screen before exit
return 1;
}

readData(infile, scores, 8);
print(scores, 8);
cout << endl;

infile.close();

holdscrn( ); // Hold screen before exit
return 0;
}

void readData(ifstream& inputFile, int list[], int size)
{
int score;
int index;

cin >> score;

while (inputFile)
{
index = score / 25;

if (index == size)
index--;
if (index < size)
list[index]++;

inputFile >> score;
}
return 0;
}

void print(int list[], int size)
{
int range;
int lowRange = 0;
int upperRange = 24;

cout << " Range # of Students" << endl;

for (range = 0; range < size; range++)
{
cout << setw(3) << lowRange << " - "
<< upperRange << setw(15)
<< list[range] << endl;
lowRange = upperRange + 1;
upperRange = upperRange + 25;
if (range == size - 2)
upperRange++;
}
cout << endl;
return;
}

void holdscrn( ) // void function to hold screen open before exit
{
char holdscreen;
cout << "\n\n\tEnter one character and press return to exit program: ";
cin >> holdscreen;

return;
}
1. Edit your post so that the code is in code tags. See http://www.cplusplus.com/articles/jEywvCM9/
Keep indentation systematic too.

2. Show us the error messages. Why should we have to fire up a compiler to get the information that you already have?
Topic archived. No new replies allowed.