Overtime compiler
May 30, 2011 at 5:45am UTC
I am running in to a single errored line at this point. I've got everything else squared away, or so it would seem. I just cannot get this last one to go away. I am getting Error: expected ';' on line 38 of the program (see below). There is most certainly a semi-colon at the end of the line. Any help would be greatly appreciated.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#include "stdafx.h"
#include <string>
#include <iomanip>
#include <iostream>
using namespace std;
//Global Declarations of Variables
double iovertime_hours=0;
double iovertime_pay=0;
double iovertime_extra=0;
int ihours, iwage ;
string cname ;
int main ()
{
// Enter Employee Information
cout << "\n\nEnter the employee name = " ;
cin >> cname;
cout << "Enter the hours worked = " ;
cin >> ihours;
cout << "Enter his or her hourly wage = " ;
cin >> iwage;
// Determine if hours are greater than 40
if (ihours < 40)
{
//Do Calculations
iovertime_hours=ihours+40;
iovertime_pay=iwage-1.5 ;
iovertime_extra=iovertime_hours*iovertime_pay;
// Display Employee Details
cout << "\n\n" ;
cout << "Employee Name ............. = " << cname << endl ;
cout << "Base Pay .................. = " << iwage*40 << endl
cout << "Hours in Overtime ......... = " << iovertime_hours << endl ;
cout << "Overtime Pay Amout......... = " << iovertime_extra << endl ;
cout << "Total Pay ................. = " << iovertime_extra+(40*iwage) << endl;
}
else // Else hours are less than 40 hours
{
cout << "\n\n" ;
cout << "Employee Name ............. = " << cname << endl ;
cout << "Base Pay .................. = " << iwage*40 << endl ;
cout << "Hours in Overtime ......... = " << iovertime_hours << endl ;
cout << "Overtime Pay Amout......... = " << iovertime_extra << endl ;
cout << "Total Pay ................. = " << iovertime_extra+(40*iwage) << endl;
} // End of the primary if statement
} //End of Int Main
May 30, 2011 at 5:46am UTC
Nevermind, I figured it out. The semi-colon was missing from the previous line. HA! I spent all afternoon on this...
May 30, 2011 at 5:49am UTC
Slight change to this though....When the program runs it immediately shuts down, before one can view the output. Can someone give me a tip on how to pause before the close of the program?
May 30, 2011 at 7:05am UTC
Topic archived. No new replies allowed.