Question: Given an incomplete program below, complete the program by filling in the blanks with an appropriate C++ statement according to the instructions stated in the

 Given an incomplete program below, complete the program by filling in

the blanks with an appropriate C++ statement according to the instructions stated

in the comments. This program intends to read the data from the

Given an incomplete program below, complete the program by filling in the blanks with an appropriate C++ statement according to the instructions stated in the comments. This program intends to read the data from the input file ("data.txt") and to display the data into the output file ("result.txt"). The data in the input file is shown in Figure 1 and the expected data in the output file is shown in Figure 2. Note: Please write C ++ statements WITHOUT blank spaces unless it is absolutely needed. Example: int num, ab; 11 1. 111 2. 22 e-01 0. 0 0 3 3 0 . 0 0 3 3 0 0 0. 2 2 2 0 0 0 111. 111 0 0 0 s um = 111. 33 Figure 2: Output file 6 1 2 3 4 Figure 1: Input file #include #include #include using namespace std; int main() { float num[10], sum = 0; int bil = 0; fstream inputfile, outputfile; 15 16 7 00 9 10 11 //a) Open the input file named "data.txt" (2 marks) 12 j 13 14 15 //b) Open the output file named "result.txt" (2 marks) 16 j 17 18 19 20 1/c) Check for successful opening file (2 marks) if ( 21 22 23 cout =0; i--) 37 38 output file

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!