Question: String and Vector in C++ Practice: Write a program that reads in a line of text and outputs the line with all the digits in

String and Vector in C++ Practice:

Write a program that reads in a line of text and outputs the line with all the digits in all integer numbers replaced with x. For example, Input: My userID is John17 and my 4 digits pin is 1234 which is secret. Output: My userID is John17 and my x digits pin is xxxx which is secret. Note that if a digit is part of a word, then the digit is not changed to an x. For example, note that john17 is NOT changed to johnxx. Include a loop that allows the user to repeat this calculation again until the user says she or he wants to end the program.

Input format: The user enters a sentence with digits in some words, and the last word end with a dot .

Output format: Turn each word with all digits to x

Terminate program: Enter -1

Sample input/output (on screen/terminal):

String and Vector in C++ Practice: Write a program that reads in

The dot . is part of last word, so dont turn this word into digits. Words are separated by a space(blank). For example, (12 / 31) includes three words 12, / and 31.

Reminder: Code in C++

Input: My userID is John17 and my 4 digits pin is 1234 which is secret. Output: My userID is John17 and my x digits pin is xxxx which is secret. Input: I have 3000 dollars, and today is 12/9. Output: I have xxxx dollars, and today is xx/9. Input: My student ID is 108501023. Output: My student ID is 108501023. Input: 1 PS C: \Users\user\Desktop

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!