I am doing a programming project for my class and I am in need of a little help here. I am unsure of how to write the code for the program to take in the info below:
Your input will come from a file with the name - OLYMPICS.TXT and have the data listed as follows with the highest and lowest score being thrown out. The remaining five scores will be averaged to determine the gymnast final score
OLGA KORBUT 8.8 7.8 3.4 8.9 10.0 6.5 9.9
MARY LOU RETTON 5.6 5.5 6.5 7.5 4.8.2.1 4.5
NADIA COMANECI 9.9 8.9 9.4 9.3 9.6 8.8.9.2
The number of Gymnasts in the file will vary.
I am able to write the code for the entire program, minus this input. Any help would be greatly appreciated.
for each line read from the file - use std::getline()
a. locate the char just before the seventh dot counting from the end - use a loop.
b. extract all the chars before this into name - use std::string::substr().
c. create a std::istringstream initialized with the substring to the right of the name.
d. read the seven scores from the string stream.
e. process the name and the scores.