February 21st, 2011, 03:19 AM
C++ code: Unable to construct "char" and "if else" statement
I have written code for the following problem but, unable to get the correct results, please advise me as to how to fix it.
I also, tried using char for making a declaration and in the statements. But,I removed it because it had too many errors. What is the correct way to format char for this type of problem.
Thank You in advance.
Jack is organizing a boat trip and needs to decide how many boats to order to hold all the people attending the event.
Write a complete C++ program that
1.prompts the user for the number of people that plan to attend the event.
2. prompts him for how many people will fit in a boat. (Assume each boat will hold the same number of people).
3. It then prints outs a message telling him how many boats he will need and whether they will be full or not.
How many people are going?: 137
How many people will fit in a boat: 10
You will need 14 boats for 137 people.
13 of them will be full and one will have only 7 people.
ANOTHER SAMPLE RUN:
How many people are going?: 144
How many people will fit in a boat: 12
You will need 12 boats for 144 people.
All of them will be full.
using namespace std;
cout << "What is the Total_of_People_Attend_Event:\n";
cin >> Total_of_People_Attend_Event;
cout << "How_Many_Boats:\n";
cout << "How many people:" << People_Per_Boat <<'\n';
if (How_Many_Boats = 14)
cout << "need_14_boats_are_not_full:\n";
cout << "You_need_12_boats_which_are_full:\n";
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!