I am working on a program that will simulate a simple student information system. The program will need to behave as follows:
a - add a student
b - display all student information
c - display a single students information
d - generate a grade report
q - quit
Currently I am working on the "add a student" function. The process I must follow is as follows:
1. Prompt the user to add the name of a student (Last, First).
2. The addUser() function will call the checkUser() function to open a text file and search to see if that student exists.
3. If the user does not exist, a generateID() function is called that will generate a random, five digit ID.
4. Finally, the addUser() function will prompt the user to enter a series of test scores and homework scores. All information (name, ID, scores) is then written to the student.txt file.
Simple enough. However, I am trying to test out a few lines of code that will actually search the text file for me.
I need it to be in two separate functions (hence why I have divided it up), so here is my code as of now:
and my student.txt file is as follows:
using namespace std;
int main (void)
cout << search() << endl;
cout << "Please enter a valid name to search for: ";
if (checkStream.eof()) break;
if (lineOfText.find("searchString", 0) != string::npos)
cout << "Done searching..." << endl;
However, my code will not output a found message when the string is found. Something is not being passed correctly. Can anyone give me some insight on this problem?