Hello. Absolute beginner.
I'm following the code in this video
https://www.youtube.com/watch?v=oVo0NVGUsU0
I worked out the code exactly as is by the end of the video. My result is different. Of all the videos I followed, this is the only time my code is producing a different result than his.
The full code is
Code:
#include <iostream>
#include <limits.h>
using namespace std;
int main() {
int value = -54656;
cout << value << endl;
cout << "Max int value: "<< INT_MAX << endl;
cout << "Max int value: "<< INT_MIN << endl;
long int lValue = 2345325345345;
cout << lValue << endl;
short int sValue = 23434;
cout << sValue << endl;
cout << "Size of int: " << sizeof(int) << endl;
cout << "Size of short int: " << sizeof(short int) << endl;
unsigned int uValue = 2342343;
cout << uValue << endl;
return 0;
}
My result in the console is
Code:
-54656
Max int value: 2147483647
Max int value: -2147483648
273201729
23434
Size of int: 4
Size of short int: 2
2342343
His result is
Code:
Max int value: 2147483647
Max int value: -2147483648
2345325345345
23434
Size of int: 4
Size of short int: 2
2342343
I also have "overflow in implicit constant conversion" here:
Code:
long int lValue = 2345325345345;
Why is my result different than his?
I'm using Eclipse Luna Service Release 2 (4.4.2), MingGW GC 78