Question: C + + Only please Write a program that reads a sentence as input and converts each word from English to a SecretCode . In
COnly 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:
First convert the sentence to upper case,
Find the substring ionregardless of case If there is one, remove the rest of
the sentence include ion
Then you append the cstring qxin lower case to the end of the sentence.
Reverse the sentence
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,
Repeat until user has entered a QUITregardless of case
You are required to use cstrings for this program. Use functions for cstrings
discussed in the class readings. No string objects may be used!
Include the following functions in the program.
he main function should be shorter than half a page.
Function header Explanation
void convertToUpperchar
str
This function should convert the given cstring to all
uppercase characters
void findAndRemovechar
str
This function should find the substring ion in the given
cstring, and remove the rest of the cstring include qx
void appendQXchar str This function should only be called when you have
successfully removed ION and the remaining string.
Append a qxlower case towards the end of the c
string.
void reversechar str This function will take the input cstring 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 strrevstr builtin function.
void
convertToSecretCodechar
str
This function should provide a dowhile 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 eg
Quit is acceptable, but not Quitting or Quit Display
a message Quit when the process is finished.
Hints:
qx will be attached to the end of the cstring regardless.
No inputs are longer than characters, guaranteed.
No input validation needed. everything and anything has a corresponding
interpretation in the secret code
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.
You may write additional functions if you want.
Other requirements:
Cstrings should be dynamically allocated. All memory dynamically allocated should be
freed as soon as you are finished with a task.
Use functions as provided in the section above. Functions should not be modified.
Follow programming style guidelines very carefully.
a Points will be taken off for all violations.
Your output style has to match with my output shown below although you can try
different user input
When accessing an array, use only pointer syntax. You should only use ptr or ptr for
accessing memory addresses or values.
NO global variables permitted.
All functions must have prototypes and the function definition listed below the main
function.
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 ;
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 EHT
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 EHT
Enter an expression to convert to the Secret Code
Please take my suggestion and run!
The secret code expression is:
XQTSEGGUS YM EKAT ESAELP
Enter an expression to convert to the Secret Code
quittin
The secret code expression is:
XQNITTIUQ
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
