要求用户输入数据并将其打印在屏幕上

要求用户输入浮点,整数并将其打印在屏幕上,以下是代码的实现:

#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);
}

相关文章

for遍历数组
。。。
声明一个计数循环
咕咕咕
#include <stdio.h> int main (void) { printf (&quo...