Question: I do not know where I am wrong, so ,could you help me fixed here is my code: #include #include using namespace std; int main()

I do not know where I am wrong, so ,could you help me fixed

here is my code:

#include #include using namespace std;

int main() { ifstream appleFS; string fileName; int appleCount; int leftoverCount;

cin >> fileName; appleFS.open(fileName); if (!appleFS.is_open()) { cout

leftoverCount = 369;

/* Your code goes here */ if(appleFS.eof()){ return true; } while (!appleFS.fail()&&!appleFS.eof()) { appleFS >> appleCount; leftoverCount = leftoverCount- appleCount; cout

I do not know where I am wrong, so ,could you helpme fixed here is my code: #include #include using namespace std; int

String fileName is read from input. The opened file named fileName contains counts of apples ordered by a grocery store, and is associated with the stream appleFS. Using a loop, read integers from the opened file and subtract each integer from leftoverCount. If an error occurs in a read operation, then the loop should terminate. Ex: If the input is data4. txt, then the output is: 81 64 98 19 42 Unused: 65 \begin{tabular}{l|l} \multicolumn{1}{r|}{ Input } & data4.txt \\ & 81 \\ & 64 \\ Your output & 98 \\ & 19 \\ & 42 \\ & Unused: 65 \\ \hline \end{tabular} 2: Compare output Output differs. See highlights below. Special character legend X 3: Compare output Output differs. See highlights below. Special character legend \begin{tabular}{l|l|} \multicolumn{1}{r|}{ Input } & data2.txt \\ & \\ & 71 \\ Your output & 57 \\ & 29 \\ & 04 \\ & Read operation failed \end{tabular}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!