0
Test case three keeps failing. What Is wrong with my code?(skee-ball)
#include <iostream> using namespace std; int main() { //variables int tck; int score; int SGT; //input cin >> score; cin >> SGT; //covetsion tck=score/12; if (tck >= SGT){ cout << "Buy it!"<<endl; } if (tck <= SGT){ cout << "Try again"<<endl; } if (tck == SGT){ cout<<"Buy it!"<<endl; } return 0; }
2 Respuestas
+ 2
Joshua Hilliard
You have already done >= so no need to do ==
Remove 3rd if and also in 2nd if there should be < only
Just do like this:
if (tck >= SGT) {
} else {
}
+ 2
Your 1st if is correct, but your 2nd should be an else block (only 1 or the other should output) and the 3rd needs to be removed. It will output "Buy it!" a second time if tck is equal to SGT.