CHALLENGE ACTIVITY 3.15.1: Character operations
5531223632930.932497
Jump to level 1
Read in a 3-character string from input into variable userPassword. Declare a boolean variable isValid and set isValid to true if userPassword does not contain any spaces. Otherwise, set isValid to false.
Ex: If the input is -23, then the output is:
Password is valid
Note: Use getline(cin, userPassword) to read the entire line from input into userPassword.
#include <iostream>
Fee
CHALLENGE ACTIVITY 3.15.1: Character operations
553122.3632930.qx32qy7
Jump to level 1
Read in a 3-character string from input into variable userPassword. Declare a boolean variable isValid and set isValid to true if userPassword does not contain any spaces. Otherwise, set isValid to false.
Ex: If the input is -23, then the output is:
Password is valid
Note: Use getline(cin, userPassword) to read the entire line from input into userPassword.
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main{
string userPassword;
/*Your code goes here*/
if (isValid){
cout << "Password is valid" << endl;
} else{
cout << "Password is not valid" << endl;
}
}
Check
Next level
Feed