I am learning programming in c++ by the book "Programming Principles and Practice Using C++(2nd Edition)". I have got a problem with some code.....
Code:
char c = 'x';
int i1 = c;
int i2 = 'x';
char c2 = i1;
cout<<c<<'<<i1<<'<<c2<<'\n';
I should get the answer "x120x" but I am getting "x1764834864x"......
Please anyone help fast????
What should I do to correct it????
I'm just a month plus into programming. Don't know if it will help but i was thinking if your int variable being assigned a character instead of a digit might be the cause. Try assigning digits to int variable and see how it goes. Sorry if i'm talking off point.