Question: The correct answer for the following question is d, can you explain it? What is the output of the final cout statement in the following
The correct answer for the following question is d, can you explain it?
What is the output of the final cout statement in the following code segment assuming that the file exam2.txt has been opened correctly and contains the following data: 5 4 6 -1 7 8? ifstream testin; testin.open(exam2.txt); int sum = 0, alpha; testin>>alpha; // test to see if file opened correctly cout<< alpha; while (!testin.eof() && alpha != -1) { testin>>alpha; sum += alpha; testin>>alpha; } cout<
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
