In the below code, suppose the user enters 32907390247810758172897213892179; what will happen? For some reason, the code interprets that number as being 2; and thus acts as if 2 were entered. However, since 2 was not entered that is a problem. How can it be fixed?
Code:#include <iostream.h> int main() { char x='0'; cout<<"Please choose (1 or 2): "; while (x!='1' && x!='2') cin>>x; if (x=='1') cout <<"hi"; if (x=='2') cout <<"bye"; return 0; }