Skee ball | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Skee ball

Where I'm making mistake Some test result are correct some wrong why https://code.sololearn.com/cDzxe6JYBX98/?ref=app

23rd Dec 2021, 4:52 PM
Lalala
Lalala - avatar
6 Answers
+ 8
Lalala , there are 2 issues in the code. please read the task description carefully. #include <iostream> using namespace std; int main(){ int points ; int SquirtGun ; cin >> points; cin >> SquirtGun ; //if ( SquirtGun < points ){ // >>> logic not correct if ( SquirtGun <= (points /12)) { cout << "Buy it!" ; //return 0; // >>> not required } //else ( SquirtGun > points ); // >>> else clause can not have a condition else { cout << "Try again" ; } return 0; }
23rd Dec 2021, 6:01 PM
Lothar
Lothar - avatar
+ 1
You will get points as input, not tickets 😉 And you will it not only buy if the price is less your tickets, but also if it is equal.
23rd Dec 2021, 4:59 PM
Coding Cat
Coding Cat - avatar
+ 1
Lalala your code produce the expected output for some cases. But this result is by random, and based on your generally wrong code. 1. Take points as input. 2. Calculate the number of tickets for this points. 3. Compare the price with the tickets, and buy if it's less or equal.
23rd Dec 2021, 6:03 PM
Coding Cat
Coding Cat - avatar
+ 1
Coding Santa oooow I missed that point about 12 thanx
23rd Dec 2021, 6:07 PM
Lalala
Lalala - avatar
0
Coding Santa man when it inputs 100 50 İst wrong Bu it inputs 10000 600 it works and it's just idk why
23rd Dec 2021, 5:27 PM
Lalala
Lalala - avatar
0
#include <stdio.h> int main() { float points; scanf("%f",&points); points/=12; if(points>39) printf("Buy it!"); else printf("Try again"); } Where is the mistake ???
21st Oct 2023, 4:55 AM
Abhay Gomkale
Abhay Gomkale - avatar