编译后无法运行,求指教
刚学C语言,实话说,什么都不懂。请各位帮我看看一下哪里出错么?
作业原题是在
https://sites.
tasks中的第二题,
由于题目比较长,英文程度也有限,翻译起来可能会有出入,如果确实需要翻译,我再试试看,可以么?
摆脱了
#include <stdio.h>
float jog(float num, int flag);
float hearizon(float num, int flag);
int round_to_int(float num);
int round_to_int2(float num);
main()
{
float num;
int flag;
scanf("%f", &num);
flag = scanf("%f", &num);
printf("Here is Your Overage Charge With Jog: $%.2f", jog(num));
printf("Here is Your Overage Charge With Hearizon: $%.2f", hearizon(num));
}
float jog(float num, int flag)
{
float gross, jog_charge;
int jog_flag;
jog_flag = flag;
gross = 0;
while (jog_flag != EOF)
{
round_to_int(num);
gross = gross + round_to_int(num);
}
jog_charge = gross * 0.05;
return jog_charge;
}
float hearizon(float num, int flag)
{
float gross, hear_charge;
int hear_flag;
hear_flag = flag;
gross = 0;
while(hear_flag != EOF)
{
gross = gross + num;
}
round_to_int2(gross);
hear_charge = round_to_int2(gross) * 0.07;
return hear_charge;
}
int round_to_int(float num)
{
int round_num;
if ((num - (int) num) >= 0.5)
{
round_num = ((int) num) + 1;
}
else
{
round_num = (int) num;
}
return round_num;
}
int round_to_int2(float gross)
{
int round_num;
if ((gross - (int) gross) >= 0.5)
{
round_num = ((int) gross) + 1;
}
else
{
round_num = (int) gross;
}
return round_num;
}