#include <iostream>
#include <string>
#include <cctype>
usingnamespace std;
int main()
{
string username;
char choice = 'Y';
double unit, X;
do
{
cout << "Please enter username"<<endl;
getline(cin,username);
cout << "Please enter total water usage: "" ";
cin >> unit;
if (usage <=10)
X = 15;
elseif (unit >10 && unit <=25)
X = unit *11;
elseif (unit <=55)
X = 200 + (unit -25)*22;
else
{
X = (80 + (unit - 55) * 50);
}
cout <<username<<" ""your total bill is<< X << endl;
cout << "Press any key to continue or E to exit" <<endl;
cin >> choice;
}while (toupper(choice) != 'E');
}
Hi Gunnerfunner,
Many thanks.
so i include cin.ignore(numeric_limits<streamsize>::max(), '\n'); after if (usage <=10) and after } ?
its still dont work.. :S