Noob question for transportation exercise c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Noob question for transportation exercise c++

the exercise says my oupout should be 24 but I run the program it says that my output should be 38. Please Help me understand my mistake https://code.sololearn.com/c0i0UDVNKVld/?ref=app

23rd Oct 2022, 8:14 AM
Marvin Guedj
Marvin Guedj - avatar
9 Answers
+ 1
A͢J The input isn't 126? do I have to put cin a
23rd Oct 2022, 9:20 AM
Marvin Guedj
Marvin Guedj - avatar
+ 1
A͢J Thanks
23rd Oct 2022, 10:22 AM
Marvin Guedj
Marvin Guedj - avatar
+ 1
Marvin Guedj input 126 was just in example but there are multiple test cases so input might be different for each case.
23rd Oct 2022, 10:30 AM
A͢J
A͢J - avatar
+ 1
@ understood thanks
23rd Oct 2022, 10:31 AM
Marvin Guedj
Marvin Guedj - avatar
+ 1
Your code works right, Based on your input your output will be different.
23rd Oct 2022, 11:01 AM
Hedieh Waisi
0
Marvin Guedj You have to take input and store in variable 'a'
23rd Oct 2022, 8:57 AM
A͢J
A͢J - avatar
0
Marvin Guedj Yes cin << a;
23rd Oct 2022, 10:12 AM
A͢J
A͢J - avatar
0
A͢J can you explain why I need to use user input cin and can't just define the variable and what are the differences
23rd Oct 2022, 10:29 AM
Marvin Guedj
Marvin Guedj - avatar
0
Hallo
24th Oct 2022, 6:31 PM
Thiruppathi ucp Ra
Thiruppathi ucp Ra - avatar