我有一個代碼,用戶必須把升價的油漆價格...但它只接受像「2.50」的價格,我可以讓程序轉換成一個點,如果用戶把「 2,50" ?使用C!我可以讓程序讀取'嗎? '如果用戶放置','?使用C
printf ("\n How many liters of green paint we'll use? ");
scanf ("%d", &green);
printf ("\n How many liters of blue paint we'll use? ");
scanf (" %d", &blue);
printf ("\n What's the price for the liter of green paint? ");
scanf ("%f", &priceG);
fflush(stdin);
printf ("\n What's the price for the liter of blue paint? ");
scanf ("%f", &priceB);
你必須改變你的_locale_。見例如['setlocale'](http://en.cppreference.com/w/c/locale/setlocale)。 –