I changed my code to this which now makes sense
#include <iostream>
#include <string>
using namespace std;
//user defined functions
void GetRate()
{
cout << "Hourly Rate? ";
}
/************************************************/
void GetHrs()
{
cout << "Hours Worked? ";
}
/*************************************************/
float GetPay (float r, float h)
{
float p;
p = r * h;
return(p);
}
/*
*
*/
int main()
{
//declare variables
string name;
float rate;
float hours;
float pay;
//get Employee's name
cout << "Employee name? ";
cin >> name;
//Get employee hourly rate
GetRate();
cin >> rate;
//Get hours worked
GetHrs();
cin >> hours;
//Calculate pay and print to screen
float x=hours, y=rate, total;
total = GetPay(x, y);
cout << name << " earned " << total;
cin >> pay;
return 0;
}
Is the program storing the value of "total" into the variable pay?

New Topic/Question
Reply




MultiQuote



|