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++
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)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images