int main()
{
double meal_cost,
tax = 0.0935,
tip = .18;
int Tax_MC,
bill,
total_bill,
Tip_TB;
//Find out cost of meal
cout << "Enter the cost of the meal before tip and tax" << meal_cost << endl;
cin >> meal_cost;
//Calculate the tax of the meal cost
Tax_MC = meal_cost * tax;
//Calculate the amount of the bill
bill = Tax_MC + meal_cost;
//Calculate the cost of the tip from bill
Tip_TB = bill * tip;
//Calculate the total amount of the bill plus tip
total_bill = bill + Tip_TB;
//Display the results
cout << "The meal cost came up to $" << meal_cost <<" without tax" << endl;
cout << "The tax amount of the meal cost is $" << Tax_MC << endl;
cout << "The tip came up to $" << Tip_TB << endl;
cout << "The amount of the bill plus tip is $" << total_bill << endl;
system("pause");
return 0;
}
This error keeps coming up.....
The variable "meal_cost" is being used with out being initialized
#include <iostream>
usingnamespace std;
int main()
{
double meal_cost,
tax = 0.0935,
tip = .18;
int Tax_MC,
bill,
total_bill,
Tip_TB;
//Find out cost of meal
cout << "Enter the cost of the meal before tip and tax" << meal_cost << endl;
cin >> meal_cost;
//Calculate the tax of the meal cost
Tax_MC = meal_cost * tax;
//Calculate the amount of the bill
bill = Tax_MC + meal_cost;
//Calculate the cost of the tip from bill
Tip_TB = bill * tip;
//Calculate the total amount of the bill plus tip
total_bill = bill + Tip_TB;
//Display the results
cout << "The meal cost came up to $" << meal_cost <<" without tax" << endl;
cout << "The tax amount of the meal cost is $" << Tax_MC << endl;
cout << "The tip came up to $" << Tip_TB << endl;
cout << "The amount of the bill plus tip is $" << total_bill << endl;
system("pause");
return 0;
}
This is your program.
Line 16: you print the variable meal_cost, which is a double, without initialize it. You have just to write:
1 2
cout << "Enter the cost of the meal before tip and tax"<< endl;
cin >> meal_cost;