Unqualified-ID error
I keep getting an unqualifies-id before token '{' on line 42. Any help would be grewatly appreciated. My program is not complete yet.
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#include <iostream> //Header file meaning Input/Output Stream
using namespace std;
struct week
{
int hours;
double rate;
};
week calculateWeek (week& w)
{
cout << "Enter Hours: ";
cin >> w.hours;
cout << "Enter Rate:$ ";
cin>> w.rate;
return w;
}
int main() //main function
{
int hours;
int rate;
int week;
double otHours;
double regPay = 0;
double otPay = 0;
double totalGrossPay = 0;
{
if (hours <= 40)
regPay = rate * 40;
else
double otHours = hours - 40;
rate = rate * 1.5;
regPay = regPay + (rate * otHours);
}
}
week One;
{ calculateWeek(One);
cout<< endl<< "Week 1 hours is: " << One.hours <<" and pay is: $ " << One.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
week Two;
calculateWeek(Two);
cout<< endl<< "Week 2 hours is: " << Two.hours << " and pay is: $ " << Two.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
week Three;
calculateWeek(Three);
cout<< endl<< "Week 3 hours is: " << Three.hours << " and pay is: $ " << Three.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
week Four;
calculateWeek(Four);
cout<< endl<< "Weekly hours is: " << Four.hours << " and pay is: $ " << Four.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
week Five;
calculateWeek(Five);
cout<< endl<< "Weekly hours is: " << Five.hours << " and pay is: $ " << Five.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
return 0;
}
|
If you fix the indentation it should be pretty apparent what the problem is.
I appologize, I still do not see it.
See what's wrong now?
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <iostream> //Header file meaning Input/Output Stream
using namespace std;
struct week
{
int hours;
double rate;
};
week calculateWeek (week& w)
{
cout << "Enter Hours: ";
cin >> w.hours;
cout << "Enter Rate:$ ";
cin>> w.rate;
return w;
}
int main() //main function
{
int hours;
int rate;
int week;
double otHours;
double regPay = 0;
double otPay = 0;
double totalGrossPay = 0;
{
if (hours <= 40)
regPay = rate * 40;
else
double otHours = hours - 40;
rate = rate * 1.5;
regPay = regPay + (rate * otHours);
}
}
week One;
{
calculateWeek(One);
cout<< endl<< "Week 1 hours is: " << One.hours <<" and pay is: $ " << One.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
week Two;
calculateWeek(Two);
cout<< endl<< "Week 2 hours is: " << Two.hours << " and pay is: $ " << Two.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
week Three;
calculateWeek(Three);
cout<< endl<< "Week 3 hours is: " << Three.hours << " and pay is: $ " << Three.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
week Four;
calculateWeek(Four);
cout<< endl<< "Weekly hours is: " << Four.hours << " and pay is: $ " << Four.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
week Five;
calculateWeek(Five);
cout<< endl<< "Weekly hours is: " << Five.hours << " and pay is: $ " << Five.rate <<endl;
cout <<"________________________________________________________________________"<<endl;
return 0;
}
|
Do I need to do something with the weeks?
Topic archived. No new replies allowed.