Question: C + + Only please Write a program that reads a sentence as input and converts each word from English to a SecretCode . In

C++Only please
Write a program that reads a sentence as input and converts each word from English to a
SecretCode. In this version, to convert a word to the Secret Code you would follow the
following steps:
1. First convert the sentence to upper case,
2. Find the substring ion(regardless of case). If there is one, remove the rest of
the sentence include ion.
3. Then you append the c-string qx(in lower case) to the end of the sentence.
4. Reverse the sentence
5. append the length of the sentence to the end. (Note: do this as a cout of the
sentence followed immediately by a cout of the sentences length. You do not
need the length to be a part of the final sentence string,
6. Repeat until user has entered a QUIT(regardless of case).
7. You are required to use c-strings for this program. Use functions for c-strings
discussed in the class readings. No string objects may be used!
8. Include the following functions in the program.
he main function should be shorter than half a page.
Function header Explanation
void convertToUpper(char
* str)
This function should convert the given c-string to all
upper-case characters
void findAndRemove(char*
str)
This function should find the substring ion in the given
c-string, and remove the rest of the c-string include qx
void appendQX(char* str) This function should only be called when you have
successfully removed ION and the remaining string.
Append a qx(lower case) towards the end of the c-
string.
void reverse(char * str) This function will take the input c-string parameter and
reverse the content. For example, if the original str is
hello, the function should change the str to olleh.
Do not use the strrev(str) built-in function.
void
convertToSecretCode(char
* str)
This function should provide a do-while loop (or a while
loop) to convert user input to upper case first, then calls
findAndRemove and appendQX and reverse in that
order. Notice your program should stop as soon as user
has entered a quit message regardless of the case (e.g.
Quit is acceptable, but not Quitting or Quit!). Display
a message Quit! when the process is finished.
Hints:
1.qx will be attached to the end of the c-string regardless.
2. No inputs are longer than 80 characters, guaranteed.
3. No input validation needed. (everything and anything has a corresponding
interpretation in the secret code)
4. If user enters a quit or Quit or qUit or any other form of it, you dont need to
convert to the secret code, simply end the program.
5. You may write additional functions if you want.
Other requirements:
1. C-string(s) should be dynamically allocated. All memory dynamically allocated should be
freed as soon as you are finished with a task.
2. Use functions as provided in the section above. Functions should not be modified.
3. Follow programming style guidelines very carefully.
a. Points will be taken off for all violations.
4. Your output style has to match with my output shown below (although you can try
different user input).
5. When accessing an array, use only pointer syntax. You should only use ptr or *ptr for
accessing memory addresses or values.
6. NO global variables permitted.
7. All functions must have prototypes and the function definition listed below the main
function.
8. Store all values as variables, do not hardcode any values (for example: size should be
saved as a variable). Use constant variables as much as possible, for example:
const int SIZE =81;
Here are some examples from the program:
Enter an expression to convert to the Secret Code
The station is opened
The secret code expression is:
XQTATS EHT10
Enter an expression to convert to the Secret Code
The student's education is important yet expensive
The secret code expression is:
XQTACUDE S'TNEDUTS EHT22
Enter an expression to convert to the Secret Code
Please take my suggestion and run!
The secret code expression is:
XQTSEGGUS YM EKAT ESAELP24
Enter an expression to convert to the Secret Code
quittin
The secret code expression is:
XQNITTIUQ9
Enter an expression to convert to the Secret Code
Quit
QUIT!

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 Programming Questions!