Exercises 11.12 Exercises
The exercises in this chapter make use of the following datafiles.
2.
3.
First Last Grade GPA Age
Hidden code will open the file and read past some number of the lines (determined by the input). You should add code to continue reading from
inFile
and print the first name from the next line in the file. (It is safe to use >>
for your input even though the hidden code uses getline
).
4.
First Last Grade GPA Age
Hidden code will open the file and read past some number of the lines (determined by the input). You should add code to continue reading from
inFile
and print the first name and age (with a space between) of the next line in the file. (It is safe to use >>
for your input even though the hidden code uses getline
).
5.
First Last Grade GPA Age
Hidden code will open the file and read past some number of the lines (determined by the input). You should add code to continue reading from
inFile
and print out the next three first names with a space after each. (It is safe to use >>
for your input even though the hidden code uses getline
).
Hint 1.
6.
First Last Grade GPA Age
Hidden code will open the file and read past some number of the lines. You should add code to continue reading from
inFile
and print out the average of the GPA values for all the rest of the lines. (It is safe to use >>
for your input even though the hidden code uses getline
).
Note that there is a newline after the last piece of data (the line that starts with
Gigi
and ends with 14
). You will likely need to check infile
for an error after attempting to read in the data for each line before you count the line or do anything with it.
Hint 1.
You have attempted of activities on this page.