快速提问:
#include <stdio.h>
int main(void) {
int divisor, counter, binary, counter2;
int digit0, digit1, digit2, digit3;
float decimal;
printf("Decimal\t\tBinary\n");
for (counter = 0; counter <= 15; counter++) {
printf("%d\t\n", counter);
decimal = counter;
for (counter2 = 0; counter2 <= 3; counter2++) {
decimal % 2 == 1 ? digit0 = 1 : digit0 = 0);
}
}
return 0;
}
我不断收到错误消息,即在第二个 for 循环中变量名“十进制”上的“表达式必须是可修改的值”。
为什么会这样,我该如何解决?
谢谢!