How to write a C++ to prompt the user to choose 5 different places out of 10 for movie filming then choose diff vehicle also | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to write a C++ to prompt the user to choose 5 different places out of 10 for movie filming then choose diff vehicle also

The vehicles are in full tank and also must be returned in full tank. A deposit of P10, 000.00 pesos for vehicle rented is needed and will be deducted from the total amount that the customer will pay. The rental fee is charged per day and the driver for hire is priced at P1, 500.00 pesos per day. Write a program that will compute and display the total expenses for filming the movie and the amount that each student will pay. Also, break down and display fuel consumption and the expenses such as fuel cost, rental cost, etc.

4th Dec 2021, 1:35 AM
shlee_
shlee_ - avatar
13 Answers
0
So, what you want is: Choose (exactly) 5 places; Choose a vehicle; Confirm(yes->go on, no->restart); If yes than the structure should be like this: do { for(int i=0; i<5; ++i) choose_place(); choose_vehicle(); } while(! confirm() )
4th Dec 2021, 4:20 AM
Angelo
Angelo - avatar
+ 1
We can't help you if you don't show us the code you wrote
4th Dec 2021, 3:39 AM
Angelo
Angelo - avatar
+ 1
wrap case1 inside the for-loop Remove the break before case2 Input the yes/no just before the end of the do-while-loop (remove it from the other parts), and remove the check for i<5 from the while
4th Dec 2021, 4:50 AM
Angelo
Angelo - avatar
0
The problem is when the user inputs a letter it keeps on repeating I wanted the user to only choose 5 places then proceed to vehicle part and user must only input y for yes and n for no then it will go back to the main switch case and must not break the code
4th Dec 2021, 3:58 AM
shlee_
shlee_ - avatar
0
I'm just a beginner...Can you show me how to apply it on my scwitch case?
4th Dec 2021, 4:38 AM
shlee_
shlee_ - avatar
0
Okay I'll try it. Thank you so much ☺️
4th Dec 2021, 5:17 AM
shlee_
shlee_ - avatar
0
It says choose_place() not declared
4th Dec 2021, 5:36 AM
shlee_
shlee_ - avatar
0
Of course, those are more like placeholders (you'll understand once you'll study functions) Just replace them with your actual code (or just adjust you code to look like it) do { ... switch(...) { case 1: for(...) { switch(...) {...} } // no break; case 2: switch(...) {...} break; default: ... } // input the yes/no } while(/* check the yes/no */)
4th Dec 2021, 5:59 AM
Angelo
Angelo - avatar
0
I don't know how to use placeholder
4th Dec 2021, 6:15 AM
shlee_
shlee_ - avatar
0
The output shows 5 the same name specific place selected by the user but it should be different names Angelo
4th Dec 2021, 7:09 AM
shlee_
shlee_ - avatar
5th Dec 2021, 4:39 PM
leonardo sagud