Test case three keeps failing. What Is wrong with my code?(skee-ball) | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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; }

5th Jul 2021, 6:44 PM
Joshua Hilliard
Joshua Hilliard - avatar
2 ответов
+ 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 { }
5th Jul 2021, 6:55 PM
A͢J
A͢J - avatar
+ 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.
5th Jul 2021, 6:56 PM
ChaoticDawg
ChaoticDawg - avatar