This c++ code dosent work for me | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

This c++ code dosent work for me

https://code.sololearn.com/cslFrOI1bNYd/?ref=app This code is for 1st project of c++ course but for some reason it just prints the input which is "t"

27th Jun 2021, 8:41 PM
Kairav Bhatia
Kairav Bhatia - avatar
2 Réponses
+ 6
It only prints the input unchanged if -50 < t < 50, that's the whole point of the modulo operator in that case. However, the issue in regards to the task is that you don't calculate the number of seats left, but the number of passengers on the last bus. Review the example given in the task description as well as the modulo operator if necessary for this. The number of free seats is equal to the number of passengers on the last bus subtracted from the total number of seats in the bus.
27th Jun 2021, 9:12 PM
Shadow
Shadow - avatar
+ 1
Kairav Bhatia You are just getting reminder but not subtracting from 50 which is left passengers. So There should be 50 - t % 50;
28th Jun 2021, 1:20 AM
A͢J
A͢J - avatar