extracting an A+ from a line of mixed data

i have a problem that i need to read a file that has data arranged line by line like this:

firstname lastname A+

the names are all different as well as the grades

the purpose of the program is to find the gpa of the whole class

the main function will pass only the grade as a string to a function called getgp

i have a pretty good handle on that function so i dont need help there

what i need help on is how to get the program to analyze each line to find the grade and then pass it to the getgp function.

i really appreciate any help you gurus can offer so thanks in advance!

Last edited on
Can you open and read text files? Post your code for reading the text file. If you don't have any code about that, google for std::ifstream.
Once you know how to read a file line by line, then really all you have to do is examine the last two characters of each line. The last two characters will be " F", "D-", " D", "D+", "C-", etc. You'll have to trim the space in front of any grade that doesn't have a '+' or '-'.
Topic archived. No new replies allowed.