在做CS50问题集1-现金时,当我尝试编写代码时,我遇到了以下问题。我已经将变量声明为整数。为什么它还在发生?非常感谢你的帮助。
“二进制表达式的操作数无效('float‘和'float')”
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(){
float owe_in_dollars;
float owe_in_cent;
int coin_count = 0;
do
{
owe_in_dollars = get_float("Change: ");
}while(owe_in_dollars<0);
owe_in_cent = (int)(owe_in_dollars*100);
if (owe_in_cent%(int)25 > 0){
coin_count++;
}
printf("%i", coin_count);
}
https://stackoverflow.com/questions/55876843
复制相似问题