Write a program that reads in a line consisting of a student’s name, Social Security number, user ID, and password. The program outputs the string in which all the digits of the Social Security number and all the characters in the password are replaced by x. (The Social Security number is in the form 000-00-0000, and the user ID and the password do not contain any spaces.) Your program should not use the operator [] to access a string element.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 8PE: Write a program that reads in a line consisting of a students name, Social Security number, user ID,...
icon
Related questions
Question

 

C++

Write a program that reads in a line consisting of a student’s name, Social Security number, user ID, and password. The program outputs the string in which all the digits of the Social Security number and all the characters in the password are replaced by x. (The Social Security number is in the form 000-00-0000, and the user ID and the password do not contain any spaces.) Your program should not use the operator [] to access a string element.

for example, input would be something like

Will Sam 577888222 SamJ 999Password 

output as 

Will Sam xxxxxxxxx SamJ xxxxxxxxxx

 

Use the apppropiate functions below

strVar.at(index)
strVar[index]
strVar.append(n, ch)
strVar.append(str)
strVar.clear()
strVar.compare(str)
strVar.empty()
strVar.erase()
strVar.erase(pos, n)
strVar.find(str)
strVar.find(str, pos)
strVar.find_first_of(str, pos)
strVar.find_first_not_of(str, pos)
strVar.insert(pos, n, ch)
strVar.insert(pos, str)
strVar.length()
strVar.replace(pos, n, str)
strVar.substr(pos, len)
strVar.size()
strVar.swap(str1)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning