- 1
Help me in
#include <iostream> #include <string> using namespace std; int main() { string pass; getline (cin,pass); char test='!'; '@'; '#'; '
#x27;; '%';'&'; '*'; if (sizeof(char)>=2,sizeof(int)>=2,pass.length()>7){ cout<<"Strong"<<endl; } else{ cout<<"Weak"<<endl; } return 0; }2 Respostas
+ 3
char test='!'; '@'; '#x27;; '%'; '&'; '*';
I'm not quite sure what you are trying in this line. If you want to declare multiple characters, you might want to use an array.
sizeof( char ) >= 2
The size of a character is always 1, as dictated by the standard. The comparison is meaningless, as it will be false anyway.
sizeof( int ) >= 2
Likewise, I'm not sure how the size of an integer relates to this program.
Furthermore, conditions are chained together by the logical operators && and ||, not by the comma operator (it has a different meaning).
I guess you are trying to solve the Password Validation exercise, but the program makes it seem like you have some fundamental misunderstanding of a few C++ concepts, making it hard to pinpoint a specific issue. You might want to revisit some chapters of the C++ course.
+ 1
Shadow thank you