Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am writing in C++ creating the files on command line. Create a file called reverse.h that contains the prototype for afunction that reverses the

I am writing in C++ creating the files on command line.

Create a file called reverse.h that contains the prototype for afunction that reverses the
characters of a C++ string:
string reverse (const string & str);

4. Create a file called reverse.cpp that contains theimplementation the function prototyped in
reverse.h. This function should reverse the characters of the C++string passed to it and
return a C++ string containing the reversed string. (30points)
5. Create a file called Ex13.cpp. This will be the application filefor this lab. You will be
submitting this file at the end of this exercise. (30 points) Theprogram should:
a. include iostream, fstream, strstream, and cstdlib
(These libraries are for hints. If you find a better library toopen file, break string,
etc. feel free to use those.)
b. include reverse.h
c. accept command line arguments
d. for each file listed on the command line following the name ofthe executable
i. print the name of the file
ii. open the file
iii. read the file line by line
iv. reverse each line of the file
v. write out the original line and the reversed line
vi. break the reversed line into white space delimited string andwrite each
string on a separate line.

6. Create a makefile to create an executable called Ex13.out. Yourmakefile should compile and
link Ex13.cpp and reverse.cpp. (30 points)

7. Execute your program using the names of the .in files as thecommand line arguments. Your output should look
something like:

File: file1.in
I think that I shall never see
ees reven llahs I taht kniht I
ees
reven
llahs
I
taht

kniht
I

The file that we are reading is named file1.in and the contentsare below-

I think that I shall never see

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

Explain the importance of Human Resource Management

Answered: 1 week ago

Question

Discuss the scope of Human Resource Management

Answered: 1 week ago

Question

Discuss the different types of leadership

Answered: 1 week ago

Question

Write a note on Organisation manuals

Answered: 1 week ago

Question

LG2 Understand the purpose and contributions of economic analysis.

Answered: 1 week ago