computing wages

Feb 20, 2015 at 4:23am
Write your question here.
ok so when i do the calculation at line 24 (last line) to get the wages, when i compile it it doesnt give me a proper pay like $450.00 instead it gives me $4.e.....
how do i get it to show me proper numbers super noob at this programming thing
my instructor is of no help just yells at the kids


#include <iostream>
#include <iomanip>
#include <conio.h>
using namespace std;
int main()
{

string lastname, firstname, empid;
double totalHours, payPerhour, overTimehours, grossPay, regularPay, overTimepay;
int regularHours;


cout<<" Enter employee's LAST name"<<endl;
getline(cin, lastname);
cout<<" Enter employee's FIRST name"<<endl;
getline(cin, firstname);
cout<< "Enter employee's ID Number"<<endl;
getline (cin, empid);
cout<<" Enter the employee's Total Hours worked up to a maximum of 60 hours"<<endl;
cin>> totalHours;
cout<<"Enter the employee's Pay Per Hour"<<endl;
cin>> payPerhour;

cout<< setprecision(2)<<"Regular Pay $"<< regularHours*payPerhour<<endl;

Feb 20, 2015 at 4:25am
You don't have an ending curly bracket and return 0 for int main.
Feb 20, 2015 at 4:26am
#include <string>
Feb 20, 2015 at 4:29am
I don't know why you need to use the getline function. cin seems like it will work. No one will put a space in any of your data.
Last edited on Feb 20, 2015 at 4:29am
Feb 20, 2015 at 4:29am
What is setprecision(2)?
Feb 20, 2015 at 4:39am
still does the same that gives me super long exponential answer...i just want dollars and cents
Topic archived. No new replies allowed.