i am trying to use this given tutorial and main needs to be void for future tutorials, but every time i compile it as void, it gives an error saying main must return an int. Although on the tutorial it worked.
I know math.h and string do not need to be there, but it is for future purposes.
#include <iostream>
#include <math.h>
#include <string>
usingnamespace std;
void main()
{
int people;
float bill, tip, totaltip, total;
cout << "How much is the bill? ";
cin >> bill;
cout <<"How many people will be splitting the bill? ";
cin >> people;
cout << "What is the percetage of the tip? ";
cin >> tip;
totaltip = bill *(tip/100.);
total = (totaltip + bill) /people;
cout << "The total tip at %" << tip << " is $" << totaltip << '.' << endl;
cout << "Each person will pay $" << total << '.' << endl;
}
The standard says main must return an int, but apparently some compilers will let you get away with void. I just tested with msvc 2010, and it will compile