我有以下程序:
#include <stdio.h>
int main (void)
{
int n, number, employeeNumber,counter;
float wage,hours,grossPay;
grossPay = wage*hours;
for ( counter = 1; counter <=5; ++counter) {
printf ("Enter Clock#:");
scanf ("%i",&number);
printf ("Enter Wage:");
scanf ("%f",&wage);
printf ("Enter Hours:");
scanf ("%f",&hours);
employeeNumber = 0;
for ( n = 1; n <= number; ++n)
employeeNumber +=n;
printf ("--------------------------------\n");
printf ("Clock# Wage Hours Gross\n");
printf ("--------------------------------\n");
printf ("%06i %.02f %.01f %f\n\n", number, wage, hours,grossPay);
}
return 0;
}
当我运行该程序时,grossPay 目前为零。我希望 GrossPay 等于工资*小时数,这取决于我输入的工资和小时数。任何人都可以提供有关如何解决此问题的提示吗?谢谢!