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.
13 odpowiedzi
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() )
+ 1
We can't help you if you don't show us the code you wrote
+ 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
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
0
I'm just a beginner...Can you show me how to apply it on my scwitch case?
0
Okay I'll try it. Thank you so much ☺️
0
It says choose_place() not declared
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 */)
0
I don't know how to use placeholder
0
The output shows 5 the same name specific place selected by the user but it should be different names Angelo