#include <stdio.h>
#include <math.h>
#include <cs50.h>
int main(void)
{
float x;
printf("O hai! How much change is owed?\n");
do
{
x = GetFloat();
x = x * 100;
return roundf(x);
int c = 0;
do
{
return x = x - 25;
return c = c + 1;
}
while (x >= 25);
printf("%d coins\n", c);
}
while (x <= 0);
}
当我输入一个像.60这样的浮点数时,它应该将其转换为一个整数,然后检测它是否更大这将是第一次在硬币从四分之一到一角硬币减少到镍等的过程中,但当我第一次尝试打印出第一个序列完成后得到的值时,它没有返回任何东西。我想创建一个贪婪的算法,但我的代码不会返回一个值在结尾
该代码中有三个太多的return语句。 – WhozCraig