我正在尝试制作一个贪心算法,但出现此错误:
greedy2.c:27:1: error: control reaches end of non-void function
[-Werror,-Wreturn-type]
}
^
1 error generated.
使用此代码:
int man(int argc, char* argv[])
{
float amount;
do
{
printf("Input dollar amount owed:\n");
amount = GetFloat();
}
while (amount <= 0);
int coins = 0;
while (amount >= 0.25);
{
amount = amount - 0.25;
coins++;
}
printf("Number of coins to use: %d\n", coins);
}
我的花括号有什么问题,我该如何解决?