input.c

来自「c21Examples.rar」· C语言 代码 · 共 26 行

C
26
字号
/* Demonstrates using scanf() to input numeric and text data. */

#include <stdio.h>

char lname[257], fname[257];
int count, id_num;

int main( void )
{
    /* Prompt the user. */

    puts("Enter last name, first name, ID number separated");
    puts("by spaces, then press Enter.");

    /* Input the three data items. */

    count = scanf("%s%s%d", lname, fname, &id_num);

    /* Display the data. */

    printf("%d items entered: %s %s %d \n", count, fname, lname, id_num);

    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?