不兼容的類型試圖找出這裏發生了什麼。我只是在學C,所以對我來說很容易。 :P我被分配來創建一個從釐米到英寸的單位轉換器。我懂了。現在我想通過創建選項來增加一點點。我的編譯器不喜歡我所擁有的。這是第幾行....將'float'分配給`char [3]'
main(void)
{
float centimeter;
char cnv[3];
float entry;
float oz;
float lb;
float cm;
float lb1;
centimeter=2.54;
lb1=2.2;
printf("Hello. Please type exactly, the type of conversion you would like to do.\n\n1. cm to in\n\n2. lb to kg\n");
scanf("%3c",&cnv);
if (strcmp(cnv=cm));
{
printf("Please enter your length in centimeters:\n");
scanf("%f",&entry);
printf("with %.0f centimeters in length, that converts to %.2f inches.",entry,entry/centimeter);
}
if (strcmp(cnv=lb));
{
printf("Please enter your weight in pounds:\n");
scanf("%f",&entry);
printf("with %.0f Pound(s) of weight, that converts to %.2f Kilogram(s).",entry,entry/lb1);
}
}
它給我錯誤的標題。我怎樣才能解決這個問題?
它給你什麼確切的錯誤? – turnt