having an input issue with my program
Sep 15, 2013 at 10:03pm UTC
this program is for hw. however, Im not asking for someone to do my hw for me i just need a little help. I'm having an issue with the input of the employee name and gross pay. i can input the name but it blazes right past the input of the gross pay without allowing input. what can i do to allow input of the gross pay? thank you in advance for your help.
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 28 29 30 31 32 33 34 35 36 37 38
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main ()
{
double gross_pay, fed_tax, state_tax,
soc_sec_med, health_ins, net_pay,
empl;
cout << "employee: " ;
cin >> empl;
cout << "Enter gross amount: $ " ;
cin >> gross_pay;
fed_tax = (gross_pay * .15);
state_tax = (gross_pay * .035);
soc_sec_med = (gross_pay * .085);
health_ins = 75;
net_pay = gross_pay - (fed_tax + state_tax + soc_sec_med + health_ins);
cout << "Employee: " << empl;
cout << "Gross pay: " << setw(22) << "$ " << gross_pay << endl;
cout << endl;
cout << "Withholding: " << endl;
cout << "Federal Tax: " << setw(20) << "$ " << fed_tax << endl;
cout << "State Tax: " << setw(22) << "$ " << state_tax << endl;
cout << "Social Security / Medicare: $ " << setw(3) << "$ " << soc_sec_med << endl;
cout << "Health Insurance: " << setw(15) << "$ " << health_ins << endl;
cout << endl;
cout << "Net Pay: " << setw(24) << "$ " << net_pay << endl;
return 0;
}
Last edited on Sep 15, 2013 at 11:19pm UTC
Sep 15, 2013 at 10:41pm UTC
Please use code tags.
Try putting cin.ignore();
Above your line cout << "Enter gross amount: $:" ;
.
Sep 15, 2013 at 10:54pm UTC
i did try inputing that line and still recieving the same errors. and what do you mean by code tags?
Topic archived. No new replies allowed.