Question #345156

A 2-character string, userPassword, is read from input. Replace each digit character in userPassword with '*'. Otherwise, userPassword is not changed.


Expert's answer

#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS