cin questions

i'm newby to C++.

Small code as follows:

int main(int argc, char* argv[]) {

cout << "function main() .." << '\n';

char ch1;
int int1;
cin >> ch1;
cin >> int1;
cout << ch1 << '\n';
cout << int1 << '\n';

return 0;
}

when i run the program and input the following:
function main() ..
az

i get :

a
32767

i understand the 'a' but why the integer value of 32767?
I just want to test and see what happen if instead of a numeric value assigned to int1 i used a 'z'.

i try :
ax

and i also get same results.
Last edited on
._. well Normally it should spit out the ASCII code of the key pressed (assuming you're using an ascii based system), but that does NOT look like the ascii code for z...
Thanks for your reply but i still don't understand why 32767 .. any idea?
Not the foggiest clue sorry I couldn't be more help.
What OS and Compiler are you using?
Topic archived. No new replies allowed.