0
Why my code challenge "How much Vroom" doesnt pass the test case no 2 and 5? Moreover, I have not been added input=input * 10
Why the result is multiplier by 10, 1200 become 12000 on the flying or run? https://code.sololearn.com/cbQF1iV2rXgt/?ref=app
1 Réponse
0
When checking if hp > 800, you output the hp and "too much", but you did not set the horsepowers member of the class.
Then in main you call the gethorsepower function, which outputs 0 for the hp since it was not set when > 800. This extra 0 is why you see 12000, the 1200 (output from set function) and the 0 (output from get function call in main).
By what the sample output shows in your comments, it seems like it might still want you to set the hp variable, when greater than 800. You could try to switch your cout<<hp line in the set function to set the hp member and see if that works.