can't understand why cout << someInt << endl; returns 65
Jul 5, 2017 at 5:07am UTC
I ran the code below on my terminal and it returned A 65. I understand why it returned A but I am absolutely clueless as to where 65 comes from. I went through my code line by line and still can't figure it out. Can someone please explain it to me? Thank you!
cout << someChar << " "<< someInt << endl;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
int someInt,
w = 5, x = 9, y = 2, z = 7;
char someChar = 'A' ;
cout << "tryIt3A output \n" ;
z += 3;
cout << z << " " << z % w << endl;
z *= w + y;
cout << z << endl;
z -= 60.1;
cout << z << endl;
cout << (x-1) / (x-w) * y << endl;
cout << (x-1) / ((x-w) * y) << endl;
cout << static_cast <double >(x) / y << endl;
cout << x / y << endl;
cout << (w + x % 7 / y) << endl;
cout << (abs(y - w) + sqrt(x)) << endl;
someInt = someChar;
cout << someChar << " " //returns A 65.
<< someInt << endl;
return 0;
}
Jul 5, 2017 at 6:20am UTC
I explained it in the other post...
Jul 5, 2017 at 12:07pm UTC
Just a quick note, please make your title give a clear description of the problem
Topic archived. No new replies allowed.