Question: A website requires that passwords only contain numbers. For each character in passPhrase that is not a number, replace the character with ' 0 '

A website requires that passwords only contain numbers. For each character in passPhrase that is not a number, replace the character with '0'(the number zero).
Ex: If the input is 2>43, then the output is:
Valid password: 2043
Note: isdigit() returns true if a character is a digit, and false otherwise. Ex: isdigit('8') returns true. isdigit('a') returns false #include
#include
using namespace std;
int main(){
string passPhrase;
unsigned int i;
getline(cin, passPhrase);
/* Your code goes here */
cout << "Valid password: "<< passPhrase << endl;
return 0;
}

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!