Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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):

image text in transcribed

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

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions