Read Mixed Values
easyQuestion 582The starter first writes the single line Alice 30 5.5 into person.txt (that part is done for you), then opens the file as ifstream in. Three variables are declared: string name, int age and double height. At the marked comment, read the three values from the file, in that order, using >>. The existing cout line then prints the output shown in Expected Output.
That line is the only output.
Expected output
Alice is 30 years old= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
Streamsifstream
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.