#include <stdio.h>
int main(){
float a;
printf("Enter Real Number: ");
scanf("%f", &a);
int b;
b=a*0.393701/12;
float c;
c=a*0.393701%12;
printf("b, c");
return 0;
}
給出了錯誤數學相關的C++
10|error: invalid operands of types 'float' and 'double(double, double)' to binary 'operator*'|
10|error: expected ';' before 'of'|
有人能指出錯誤嗎?
太棒了,它做了詭計,非常感謝:)) – Dish
別忘了['fmod(...)'](http://www.cplusplus.com/reference/cmath/fmod/)。在C++中可能沒有操作符這樣做(操作符***是爲Java中的浮點類型定義的),但它自從C以來一直是標準庫的一部分。 –