Friday, July 31, 2009

I'm studying C++, I'm trying to declare hours as an integer & pay & wages as a float. How do I do this?

Also write assignment statement: currently I have this


cout %26lt;%26lt; endl ;


cout %26lt;%26lt; "Number of hours worked during"


%26lt;%26lt; " the week (integer) = " ;


cin %26gt;%26gt; hours_worked ;


// read in the pay rate


cout %26lt;%26lt; "Weekly pay rate (specify two digits "


%26lt;%26lt; "after the decimal point) = " ;


cin %26gt;%26gt; pay_rate ;


// compute wages


write assignment statement to compute wages ;

I'm studying C++, I'm trying to declare hours as an integer %26amp; pay %26amp; wages as a float. How do I do this?
wages= float(hours_worked) * pay_rates ;





this is the statement for ur program to compute wages
Reply:float total_pay;


int hours_worked;


float pay_rate;





// Your code





total_pay = (float)hours_worked * pay_rate


No comments:

Post a Comment