Question: this is a c++ question...please help...urgent Given an incomplete program below, complete the program by filling in the blanks with an appropriate C++ statement according
this is a c++ question...please help...urgent
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 (input.txt) and to display the data into the output file (output.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,a,b;

#include#include #include using namespace std; int main() { char name[10][40]; int cnt = 0; fstream inputfile, outputfile; //a) Open the input file named "input.txt" (2 marks) Answer; //b) Open the output file named "output.txt" (2 marks) Answer; //c) Check for successful opening file (2 marks) if (Answer) { cout return 0; } //d) Read data from the input file (4 marks) do { Answer(Answer, 40); cnt++; } while (Answer); //e) Write data to the output file (3 marks) for (int i=cnt-2; i>=0; i--) Answer //f) Close the input file (1 mark) Answer; //g) Close the output file (1 mark) Answer; return 0; }
A N YAH Q B A T N TUN A D A H L Figure 1: Input file I A L A H UN I OB S Y A H A D A N I N T Figure 2: Output file T 1 2 3 4 5 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
