基本概念-读取输入

参考:http://edu.51cto.com/roadmap/view/id-59.html

8.读取输入


8.1 可以使用scanf 函数来读取输入

8.2 实例

#include <stdio.h>
int main(void)
{
    int pid;
    int age;
    float salary;
    char name[10];
    printf("请输入pid:\n");
    //输入pid
    scanf("%d",&pid);
    printf("请输入age:\n");
    //输入age
    printf("请输入age:\n");
    scanf("%d",&age);
    //输入salary
    printf("请输入salary:\n");
    scanf("%d",&salary);
    //输入name
    printf("请输入name:\n");
    scanf("%d",&name);
    printf("pid=%d,age=%d,salary=%.2f,name=%s",pid,age,salary,name)
    return 0;
}


你可能感兴趣的:(读取输入)