So quick question,what the hell...look at this part of code,how did i get 'b' to be 4309823 cause it is that big when i run program?? is my PC gay?There is nothing before 'int main()' except '#include <iostream>' and 'use namespace std'.
[code]
Put the code you need help with here.
[//this is part of code.
int main(){
int x, y, b, a;
cout << "Type 2 numbers: ";
cin >> x, y;
a = x - 1;
b = y - 1;
cout << a << " " << b << endl;
}
]
//and this is result when i run program:
Type 2 numbers: 24 54
23 4309823
//I spent over 2 hours trying to figure this out and nothing...it should set 'b' to 'y - 1' which is 53 but instead it sets it to this HUGE number for no reason...
cin >> x, y;
Surely you mean cin >> x >> y;
The comma operator evaluates and discards its right operand, (that is std::cin >> x), and discards the result, leaving y uninitialized.