【发布时间】:2018-09-11 16:24:43
【问题描述】:
这是一条错误消息:
从不兼容的类型'float(const string,...)'(又名'float(char *const,...)')分配给'float'
代码:
int main(void) {
float n = -1;
int z = 0;
int counter = 0;
do {
printf("Input positive money amount such as $5.13 as '5.13' \n");
n = get_float;
} while (n < 0);
n = n * 100;
n = round(n);
z = n;
while (z >= 25) {
z = z - 25;
counter++;
}
while (z >= 10) {
z = z - 10;
counter++;
}
while (z >= 5) {
z = z - 5;
counter++;
}
while (z >= 1) {
z = z - 1;
counter++;
}
printf("number of minimum coins needed %d", counter);
}
【问题讨论】:
-
你能显示代码吗?
-
@sabatilius 将代码放在问题中而不是评论中。