如何在C调试错误中确定周工资;

如何在C调试错误中确定周工资;,c,debugging,emacs,printf,C,Debugging,Emacs,Printf,我正在创建一个计算周薪的程序,其中加班费是周薪的1.5。 这是我的代码: #include <stdio.h> int main() { double payrate; double hours; double weeklypay = hours * payrate; double overtimehours = hours - 40; double overtimepay = weeklypay * 1.5; double overtimesalary

我正在创建一个计算周薪的程序,其中加班费是周薪的1.5。 这是我的代码:

#include <stdio.h>

int main()
{

  double payrate;
  double hours;
  double weeklypay = hours * payrate;
  double overtimehours = hours - 40;
  double overtimepay = weeklypay * 1.5;
  double overtimesalary =  weeklypay + (overtimehours * overtimepay);

  printf("What is your standard hourly pay rate?\n");
  scanf("%d",&payrate);
  printf("How many hours do you work in a week?\n");
  scanf("%d",&hours);

  if (hours <= 40)
    printf("This means your weekly pay is %d . \n", weeklypay);

  else (hours > 40)
     printf("This means your weekly pay is %d . \n", overtimesalary);


  return 0;
}
我意识到我在做傻事;如果有人能帮我认识到我的错误,我将不胜感激。

if(40小时)
  if (hours <= 40)
    printf("This means your weekly pay is %d . \n", weeklypay);

  else (hours > 40)
     printf("This means your weekly pay is %d . \n", overtimesalary);
printf(“这意味着你的周薪是%d.\n”,超额工资);
您错过了else中的if:

  if (hours <= 40)
    printf("This means your weekly pay is %d . \n", weeklypay);

  else if (hours > 40)
     printf("This means your weekly pay is %d . \n", overtimesalary);
if(40小时)
printf(“这意味着你的周薪是%d.\n”,超额工资);
或者在这种情况下,您可以将其删除:

  if (hours <= 40)
    printf("This means your weekly pay is %d . \n", weeklypay);

  else
     printf("This means your weekly pay is %d . \n", overtimesalary);
if(小时
if(40小时)
printf(“这意味着你的周薪是%d.\n”,超额工资);
您错过了else中的if:

  if (hours <= 40)
    printf("This means your weekly pay is %d . \n", weeklypay);

  else if (hours > 40)
     printf("This means your weekly pay is %d . \n", overtimesalary);
if(40小时)
printf(“这意味着你的周薪是%d.\n”,超额工资);
或者在这种情况下,您可以将其删除:

  if (hours <= 40)
    printf("This means your weekly pay is %d . \n", weeklypay);

  else
     printf("This means your weekly pay is %d . \n", overtimesalary);

if(小时)为什么用
emacs
标记此项?为什么用
emacs
标记此项?