I need to write a program that prompts the user for how many people are eating at a restaurant and how much the bill is, and then calculates how much a 16% tip would be, a 20% tip, and how much each person should pay if everyone is to pay the same amount. I need to set up the program so that it outputs information in a list format with information in two columns with dots seperating the columns. Like this:
Number of people eating.....................5
Bill amount..................................$20.00
Here is what I've got so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
double peopleEating;
double billAmount;
double exit;
cout << " This program will calculate how much the tip should be and how much each person should pay after eating at a restaurant. " << endl;
cout << " How many people are eating? " << endl;
cin >> peopleEating;
cout << " How much was the bill? " << endl;
cin >> billAmount;
cout << setfill('.');
cout << left;
cout << "Number of people eating";
cout << cout.unsetf(ios::left);
cout << right;
cout << peopleEating;
cout << cout.unsetf(ios::right);
cout << " Type exit to exit. " << endl;
cin >> exit;
}
|
When I compile it I get two errors that both read
"error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'void' (or there is no acceptable conversion)"
I haven't even tried to do the math yet. I think if I can figure out this list part the rest will be easy.
What am I doing wrong and how can I fix it? Many thanks in advance for any assistance.