dimanche 28 mai 2017

comparing the character in their numerical representation gone wrong in c++

#include <iostream>

using namespace std;

int main()
{
string sound;
if('h'==char(106), 'a'==char(97), 't'==char(114), ' '==char(118),
'i'==char(105), 's'==char(115))
//the  numerical representation letter by letter should be "jarvis"  and I         
compare them in "hat is"
{
cout << "correct" << endl;//and to my suprise the program shows  it is 
correct

}

else
cout <<"wrong" ;
return 0;
}

I compare the numerical representation of jarvis to hat is and the program show it was correct, how was that possible? what makes the "hat is" the same to jarvis?

Aucun commentaire:

Enregistrer un commentaire