Moving to another question will save this response. Question 52 The given functi
ID: 3578692 • Letter: M
Question
Moving to another question will save this response. Question 52 The given function is supposed to read an integer from a file and return the value of that integer. How integer? int read int (ifstream& infile) int int value bool not found true char ch while (infile get(ch) && not found) if (isdigit (ch)) infile int value, not found false; return int value A true and false should be switched O B. The statement infile.unget should be placed immediately before the statement that reads th o C. The statement infile.unget ()i should be placed immediately after the statement that reads the D not found should be replaced by found. The statement replace should be placed Moving to another question will save this response.Explanation / Answer
Ans: C
Decrements the internal get pointer by one, making the last character extracted from the input sequence available again as the next character to be read from the stream.
Here infile.get() in while loop, we are reading a character but not using
So, again we have to make available that read character.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.