我不明白为什么第一个循环不起作用.即使填充的欠款浮动实际上大于0,它也是一个无限循环.为什么循环不起作用?
#import <cs50.h>
#import <stdio.h>
int main(void)
{
float owed = -1 ;
while (owed < 0)
{
printf("O hai! How much change is owed?\n") ;
float owed = GetFloat() ;
owed = owed * 100 ;
}
int coins = 0 ;
while (owed >= 25)
{
owed = owed - 25 ;
coins = coins + 1 ;
}
while (owed >= 10)
{
owed = owed - 10 ;
coins = coins + 1 ;
}
while …
Run Code Online (Sandbox Code Playgroud)