+ 1

Still coad coach

You are playing a game at your local arcade, and you receive 1 ticket from the machine for every 12 points that you score. You want to purchase a squirt gun with your tickets. Given your score, and the price of the squirt gun (in tickets) are you able to buy it? Task Evaluate whether or not you have scored high enough to earn enough tickets to purchase the squirt gun at the arcade. Input Format The first input is an integer value that represents the points that you scored playing, and the second input is an integer value that represents the cost of the squirt gun (in tickets). Output Format A string that say 'Buy it!' if you will have enough tickets, or a string that says 'Try again' if you will not. I inputed the below code and one test case faild Whats my mistake #include <iostream> using namespace std; int main() { int score; int price; cin>>score>>price; int c = score/12; if(c >price){ cout<<"buy it"<<endl; } else{ cout<<"try again"<<endl; } return 0;}

24th Mar 2020, 12:12 PM
Immortal Soul
Immortal Soul - avatar
2 Respuestas
+ 3
Make is (c>=price) because if price is equal to the score then also you can buy the squirt gun Here's the fix👇 https://code.sololearn.com/cmwZ709S5rUC/?ref=app
24th Mar 2020, 12:18 PM
Arsenic
Arsenic - avatar
0
I fixed it anyways guys thank u
24th Mar 2020, 12:39 PM
Immortal Soul
Immortal Soul - avatar