A 2-character string, userPassword, is read from input. Replace each digit character in userPassword with '*'. Otherwise, userPassword is not changed.
#include <iostream>
int main() {
int n = 2;
char userPassword[n];
for(int i = 0; i<n; i++){
std::cin>>userPassword[i];
if(isdigit(userPassword[i]))
userPassword[i]='*';
}
return 0;
}
Comments
Leave a comment