Question: Create a program that reads the lines of a file called code.cpp and assign a line number to each line in the order you read

Create a program that reads the lines of a file called "code.cpp" and assign a line number to each line in the order you read it. The lines should then be printed out in reverse order but the line numbers should remain the in the same order.

Create a program that reads the lines of a file called "code.cpp"

Sample Output:

0: } 1: cout > c; 5: cin >> b; 6: cin >> a; 7: 8: double a, b, c; 9: int main(int argc, char *argv[]) { 10: 11: using namespace std; 12: #include 13: #include

filereverse Microsot visual C+2010 Express File Edit inw Praject Debug Taals Windew selution Lcalorer filereversecpp Urknown Scape) Solutcn 'tilereverse 1 project) #1nclude io stream > a include aLh. h> using nanespace std; filereverse Hcoder Filcs int nainint arg char 1 double a, b, ci targetver.h Resource Hiles 1,Sourco Files cin a; cin b cin ; stelafx.cpp ReadMetxt cout

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!