123456789101112
#include <iostream> using namespace std; int main() { char a[]= "aaaa" ; char pass[]="aaaa"; cout << a << endl; if ( a==pass ) cout << "bye" << endl; else cout << "hi " << endl; return 0; }
aaaa hi
if (strcmp(a, pass) == 0)
12345678910111213
#include <iostream> #include <string> using namespace std; int main() { string a = "aaaa" ; string b ="aaac"; cout << a<< endl; if ( a==b) cout << "bye" << endl; else cout << "hi" << endl; return 0; }