我有一个代码,用户必须输入油漆升的价格......但它只接受像“2.50”这样的价格,如果用户输入“2,50”,我可以让程序将逗号转换为点吗? 使用 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);