computing wages

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;

You don't have an ending curly bracket and return 0 for int main.
#include <string>
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
What is setprecision(2)?
still does the same that gives me super long exponential answer...i just want dollars and cents
Topic archived. No new replies allowed.