0
How do i fix this code?
Here is a code i wrote long ago: include <iostream> using namespace std; int main() { int x, y; cin >> x, y; x+=1; if (x<1&&y>5){ cout << //something something; } else { cout << "( " << x << " and " << y << " ???" << " )"; } return 0; } I tried to add &&y<100 to the if statement thing, but it shows that y is a really big number and idk why?? Does this make any sense? Does anyone know how i can make the int y 0 or tell me if i did something wrong? Sorry if this is confusing. Thanks!
2 ответов
+ 7
cin >> x, y;
will only assign user input to x and not y. Do this instead:
cin >> x >> y;
And then provide two input values.
+ 3
int y = 0; //default value of 0