12345678910111213
std::string str1 = "orange"; char* cstr1 = "orange"; std::string str2 = "apples"; char* cstr2 = "apples"; if(str1[0] == str2[0]) //use subscript operator to get the nth character { .... } if(cstr1[0] == cstr2[0]) //use subscript operator to get the nth character { .... }
123456
char *myBinary; cin >> myBinary; if ( myBinary[0] == myBinary[ strlen( myBinary ) - 1 ] ) { std::cout << "YES"; }