要求用户输入浮点,整数并将其打印在屏幕上,以下是代码的实现:
#include <stdio.h>
int main()
{/*from www .yii ba i . com*/
char topping[24];
int slices;
int month, day, year;
float cost;
printf(How much does a pizza cost in your area?);
printf(enter as $XX.XX)\n);
scanf( $%f, &cost);
printf(What is your favorite one-word pizza topping?\n);
scanf( %s, topping);
printf(How many slices of %s pizza, topping);
printf(can you eat in one sitting?\n);
scanf( %d, &slices);
printf(What is today\'s date (enter it in XX/XX/XX format).\n);
scanf( %d/%d/%d, &month, &day, &year);
printf(\nWhy not treat yourself to dinner on %d/%d/%d, month, day, year);
printf(\nand have %d slices of %s pizza!\n, slices, topping);
printf(It will only cost you $%.2f!\n\n\n, cost);
return (0);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。