I need help reading a bool function from my HW assignment, I am not asking you to do complete my assignment for me. All I need help with is reading my bool function in main. Thank you for looking


using namespace std;

struct StudentType
{string studentName;
int testScore;//Between 0 and 100
char grade;


void PrintNameHeader(ostream& out);
bool OpenInputFile(ifstream& inFile, string& infilename );
void Pause();
void ReadStudentData(ifstream& infile, StudentType student[], int& );
void AssignGrades(StudentType student[], int);
int HighestScore(const StudentType student[], int );
void PrintNamesWithHighestScore(const StudentType student[], int);
void DisplayAllStudents(const StudentType student[], int);
void GetLowHighRangeValues(int& , int&);
void DisplayStudentsInRange(const StudentType student[], int, int, int);
void SortStudentsByName(StudentType student[], int);
void SortStudentsByScore(StudentType student[], int);

int main()
    const int NUM_NAMES=20;

    ifstream infile;
    string inFilename;


    bool OpenInputFile(ifstream& inFile, string& infilename);

    return 0;

//Function definitions

void PrintNameHeader(ostream& out)
    //Display name header on screen
    cout << "**************************************************" << endl;

bool OpenInputFile(ifstream& inFile, string& infilename)

    cout << "Enter the name of the file that you want to open for input.\n";
    cout << "Do not put spaces in the file name";
    cin >> infilename;
    cout << endl;

    if (inFile.fail())
        cout << "Sorry, the input file " << infilename <<" was not found"<< endl;\
            return false;   

    cout << "Input file '" << infilename << " is open for reading.\n\n";
    return true;     

void Pause()
    cout << endl;

    cin.ignore(80, '\n');

    cout<<"Please hit the enter key to continue...\n";



void ReadStudentData(ifstream& infile, StudentType student[], int& numstudents)

void AssignGrades(StudentType student[], int numstudents)

int HighestScore(const StudentType student[], int numstudents)
    int Students = 6;////dummy

    return Students;
void PrintNamesWithHighestScore(const StudentType student[], int numstudents)

void DisplayAllStudents(const StudentType student[], int numstudents)

void GetLowHighRangeValues(int& lowRange, int& highRange)


void DisplayStudentsInRange(const StudentType student[], int numStudents, int lownum, int highNum)


void SortStudentsByName(StudentType student[], int numStudents)


void SortStudentsByScore(StudentType student[], int numstudents)


Recommended Answers

All 5 Replies

Well, if you removed the data types from where you call the function in line 39...

line 39 is a function prototype, not an actual call to the function. You could just as easily move line 39 to line 27 with all the other function prototypes.

So if I take off the "ifstream& and string&" from line 39 it should work?
And thanks to both of you

No -- to call a function all you do is use the names of the variables, you do not include the data type like you do in the function prototypes. See how you did it in line 37


got it thanks :)

Be a part of the DaniWeb community

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