0
When running my "if (x == y)" getting a problem
when I run "if (x==y)" it prints BOTH conditions. what's wrong? #include <iostream> using namespace std; int main() { int score = 100; int scorewin = 100; int scorepass = 50; if (score >= scorepass){ cout << "You have enough pts to move on." << endl; if (score == scorewin ){cout << "You won! You collected all the points! Go to next level!" << endl;} } else {cout << "You do not have enough points, go back and collect more." << endl;} return 0; }
3 Answers
+ 3
This is because score is equal or above scorepass and score equals to scorewin.
+ 10
Can u insert ur code..??
well there is nothing wrong with ur code..
0
Qyther, DT
Yep, I just figured out what happened. Qyther is right; without an else statement to pair with the "score >= scorepass" condition, the program with print both outcomes.