expression must have arithmetic or unscoped enum type C++ [duplicate]

in

 std::string pword_asterix = ("*") * pword.length();

you multiply a pointer, you want something like :

std::string pword_asterix(pword.length(), '*');

after that :

[email protected]:/tmp $ g++ -Wall c.cc
[email protected]:/tmp $ ./a.out
Enter username: aze
Enter password for user 'aze': qsdqsd
Noted user 'aze' and password '******'[email protected]:/tmp $ 

Adding << std::endl to have

std::clog << "Noted user '" << user << "' and password '" << pword_asterix << "'." << std::endl;` 

makes output more clear in a shell :

[email protected]:/tmp $ g++ -Wall c.cc
[email protected]:/tmp $ ./a.out
Enter username: aze
Enter password for user 'aze': qsdqsd
Noted user 'aze' and password '******'.
[email protected]:/tmp $ 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top