Answer to Question #345156 in C++ for Alvaro

Question #345156

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


1
Expert's answer
2022-05-26T09:14:34-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS