题目说明:
示例代码:
int main() {
double meal_cost;
cin >> meal_cost;
int tip_percent;
cin >> tip_percent;
int tax_percent;
cin >> tax_percent;
double totalCost;
totalCost+=meal_cost*(tip_percent/100.0);
totalCost+=meal_cost*(tax_percent/100.0);
int total;
char buf[100];
sprintf(buf, "%.0f", meal_cost + totalCost);
total = atoi(buf);
printf("The total meal cost is %d dollars.",total);
return 0;
}
基础知识点:
1、浮点转整形时的四舍五入