- Sep 30, 2008
- 1,015
- 1
- 71
I am trying to develop a program to calculate weekly wage
1. how do you give a name to a file with the source code?
2. what is the code to declare the hours_worked as an integer? (no of hours)
is it "int hours_worked;"?
3. is the code to compute the wage correct?
#include <iostream>
using namespace std ;
int main()
{
Int hours_worked;//No. of hrs worked during week
float pay_rate; //Pay rate: dollars per week
float wages; //Weekly wages
// read in the hours worked
cout << endl ;
cout << "Number of hours worked during"
<< " the week (integer) = " ;
cin >> hours_worked ;
// read in the pay rate
cout << "Weekly pay rate (specify two digits "
<< "after the decimal point) = " ;
cin >> pay_rate ;
// compute wages
Wages = hours_worked*pay_rate;
// display the result
cout << endl ;
cout << "The weekly wages are: $" << wages << endl ;
return (0);
1. how do you give a name to a file with the source code?
2. what is the code to declare the hours_worked as an integer? (no of hours)
is it "int hours_worked;"?
3. is the code to compute the wage correct?
#include <iostream>
using namespace std ;
int main()
{
Int hours_worked;//No. of hrs worked during week
float pay_rate; //Pay rate: dollars per week
float wages; //Weekly wages
// read in the hours worked
cout << endl ;
cout << "Number of hours worked during"
<< " the week (integer) = " ;
cin >> hours_worked ;
// read in the pay rate
cout << "Weekly pay rate (specify two digits "
<< "after the decimal point) = " ;
cin >> pay_rate ;
// compute wages
Wages = hours_worked*pay_rate;
// display the result
cout << endl ;
cout << "The weekly wages are: $" << wages << endl ;
return (0);
