You could skip the output() function and do this instead to make the C++ syntax correct.
Code:
#include <iomanip>
#include <cmath>
#include <iostream>
#include <string>
#include <fstream>
const float TAX = .07, TIPS = .15, DESERT = 4.50, CHILD_RATE = .6;
using namespace std;
int main()
{
string name;
float cost_adult, room_fee, deposit;
int num_adults, num_children, num_desert;
//input section
cout << "What is your name? : ";
getline(cin,name);
cout << "How many adults will be served? : "; cin >> num_adults;
cout << "How many children will be served? : "; cin >> num_children;
cout << "How many pieces of dessert will you need? : "; cin >> num_desert;
cout << "What is the cost per adult meal? : "; cin >> cost_adult;
cout << "What is your room fee? : "; cin >> room_fee;
cout << "What is the amouunt of deposit paid when the reservation was made? : "; cin >> deposit;
//proccessing section
float cost_child, total_cost_adult, total_cost_child, total_cost_desert, total_cost_food, taxes, total_bill, balance_due, tips;
cost_child = CHILD_RATE * cost_adult;
total_cost_adult = cost_adult * num_adults;
total_cost_child = cost_child * num_children;
total_cost_desert = DESERT * num_desert;
total_cost_food = total_cost_adult + total_cost_child + total_cost_desert;
taxes = total_cost_food * TAX;
tips = total_cost_food * TIPS;
total_bill = total_cost_food + taxes + tips;
balance_due = total_bill - deposit;
cout<< setfill('-')<<setw(80)<<"-"<<endl;
cout<< '\n'<<setw(18);
cout<< "Passaic County Catering & Convention Services Final Bill"<<endl;
cout<< '\n'<<setw(4)<<"Customer: "<<"\t\t\t\t\t\t"<<name;
cout<< '\n'<<setw(4)<<"Number of Adults:"<<"\t\t\t\t$"<<num_adults;
cout<< '\n'<<setw(4)<<"Number of Children:"<<"\t\t\t\t$"<<num_children;
cout<< '\n'<<'\n'<<setw(4)<<"Cost of Meal Per Adult:"<<"\t\t\t$"<<cost_adult;
cout<< '\n'<<setw(4)<<"Cost Of Child's Meal Per Adult:"<<setprecision (2)<<fixed<<"\t$"<<cost_child;
cout<< '\n'<<setw(4)<<"Total Cost for Desert:"<<"\t\t\t$"<<total_cost_desert;
cout<< '\n'<<setw(4)<<"Total Food Cost:"<<"\t\t\t\t$"<<total_cost_food;
cout<< '\n'<<'\n'<<setw(4)<<"Plus 7.5 % Taxes:"<<"\t\t\t\t$"<<taxes;
cout<< '\n'<<setw(4)<<"Plus 15.0 % Tips:"<<"\t\t\t\t$"<<tips;
cout<< '\n'<<setw(4)<<"Plus Room Fee:"<<"\t\t\t\t\t$"<<room_fee;
cout<< '\n'<<'\n'<<setw(4)<<"Total Bill:"<<"\t\t\t\t\t\t$"<<total_bill;
cout<< '\n'<<setw(4)<<"Less Deposit:"<<"\t\t\t\t\t$"<<deposit;
cout<< '\n'<<'\n'<<setw(4)<<"Balance Due:"<<"\t\t\t\t\t$"<<balance_due;
cout<< '\n'<<'\n'<<setw(18)<<"Thank You For Using Passaic County Catering Services."<<endl;
cout<< setfill('-')<<setw(80)<<"-"<<endl;
return 0;
}
Otherwise you have to implement a function outside of the main()-function block.
Then you could let the output()-function do most of the tasks.
Code:
#include <iomanip>
#include <cmath>
#include <iostream>
#include <string>
#include <fstream>
const float TAX = .07, TIPS = .15, DESERT = 4.50, CHILD_RATE = .6;
using namespace std;
void output();
int main()
{
output();
return 0;
}
void output()
{
string name;
float cost_adult, room_fee, deposit;
int num_adults, num_children, num_desert;
//input section
cout << "What is your name? : ";
getline(cin,name);
cout << "How many adults will be served? : "; cin >> num_adults;
cout << "How many children will be served? : "; cin >> num_children;
cout << "How many pieces of dessert will you need? : "; cin >> num_desert;
cout << "What is the cost per adult meal? : "; cin >> cost_adult;
cout << "What is your room fee? : "; cin >> room_fee;
cout << "What is the amouunt of deposit paid when the reservation was made? : "; cin >> deposit;
//proccessing section
float cost_child, total_cost_adult, total_cost_child, total_cost_desert, total_cost_food, taxes, total_bill, balance_due, tips;
cost_child = CHILD_RATE * cost_adult;
total_cost_adult = cost_adult * num_adults;
total_cost_child = cost_child * num_children;
total_cost_desert = DESERT * num_desert;
total_cost_food = total_cost_adult + total_cost_child + total_cost_desert;
taxes = total_cost_food * TAX;
tips = total_cost_food * TIPS;
total_bill = total_cost_food + taxes + tips;
balance_due = total_bill - deposit;
cout<< setfill('-')<<setw(80)<<"-"<<endl;
cout<< '\n'<<setw(18);
cout<< "Passaic County Catering & Convention Services Final Bill"<<endl;
cout<< '\n'<<setw(4)<<"Customer: "<<"\t\t\t\t\t\t"<<name;
cout<< '\n'<<setw(4)<<"Number of Adults:"<<"\t\t\t\t$"<<num_adults;
cout<< '\n'<<setw(4)<<"Number of Children:"<<"\t\t\t\t$"<<num_children;
cout<< '\n'<<'\n'<<setw(4)<<"Cost of Meal Per Adult:"<<"\t\t\t$"<<cost_adult;
cout<< '\n'<<setw(4)<<"Cost Of Child's Meal Per Adult:"<<setprecision (2)<<fixed<<"\t$"<<cost_child;
cout<< '\n'<<setw(4)<<"Total Cost for Desert:"<<"\t\t\t$"<<total_cost_desert;
cout<< '\n'<<setw(4)<<"Total Food Cost:"<<"\t\t\t\t$"<<total_cost_food;
cout<< '\n'<<'\n'<<setw(4)<<"Plus 7.5 % Taxes:"<<"\t\t\t\t$"<<taxes;
cout<< '\n'<<setw(4)<<"Plus 15.0 % Tips:"<<"\t\t\t\t$"<<tips;
cout<< '\n'<<setw(4)<<"Plus Room Fee:"<<"\t\t\t\t\t$"<<room_fee;
cout<< '\n'<<'\n'<<setw(4)<<"Total Bill:"<<"\t\t\t\t\t\t$"<<total_bill;
cout<< '\n'<<setw(4)<<"Less Deposit:"<<"\t\t\t\t\t$"<<deposit;
cout<< '\n'<<'\n'<<setw(4)<<"Balance Due:"<<"\t\t\t\t\t$"<<balance_due;
cout<< '\n'<<'\n'<<setw(18)<<"Thank You For Using Passaic County Catering Services."<<endl;
cout<< setfill('-')<<setw(80)<<"-"<<endl;
}
You could create an input and output function if you want to have the input and output in separated
parts. It's your choice.