output name and course before sending them to strlow to be sure they have been read in correctly. If not, can you read the file called students when you open it in a text editor? If not how is the file called students created?
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
That's wierd. There should be no spaces in a string read in with the >> operotor as any whitespace terminates the input into the variable.
I doubt it is the problem, but this:
while (!fin.eof())
is a bug waiting to bite you. Don't use the return value of eof() to control a loop. Change it to this:
while(fin >> name)
{
fin >> course;
If necessary I'd create another file called practic.txt using a text editor and entering the following data directly into the practice.txt using the keyboard:
first course
second class
Then I'd save practice.txt to the same folder the program is in.
Then I'd run the program associating practice.txt with fin instead of students.txt and outputting the variables name and course as they are read in to see what happens. If they are read in correctly then it's likely students.txt is the problem.
Edit:: Good for you. See my other suggestion above.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396