编写input()和output()函数输入

简介: 编写input()和output()函数输入。

编写input()和output()函数输入,输出5个学生的数据记录。

include

include

typedef struct{
char name[20];
char sex[5];
int age;
}Stu;
void input(Stustu);
void output(Stu
stu);
int main()
{
Stu stu[5];
printf("请输入5个学生的信息:姓名 性别 年龄:\n");
input(stu);
printf("5个学生的信息如下:\n姓名 性别 年龄\n");
output(stu);

system("pause");
return 0;

}
void input(Stustu)
{
int i;
for(i=0;i<5;i++)
scanf("%s%s%d",stu[i].name,stu[i].sex,&(stu[i].age));
}
void output(Stu
stu)
{
int i;
for(i=0;i<5;i++)
printf("%s %s %d\n",stu[i].name,stu[i].sex,stu[i].age);
}

目录
相关文章
|
5月前
|
JavaScript 前端开发
input 输入 限制 大全
input 输入 限制 大全
211 0
|
3月前
|
固态存储 SDN
编写input()和output()函数输入
【7月更文挑战第4天】编写input()和output()函数输入。
28 1
|
Python
Python输入函数input( )
Python输入函数input( )
59 0
|
存储 程序员 Python
python--注释、变量、常量、print、input、type
python--注释、变量、常量、print、input、type
|
Python
python编程 input输入函数
本章将会讲解输入与输出中的 input()输入函数
200 0
python编程 input输入函数
|
Python
【Python零基础入门篇 · 2】:掌握各种运算符和变量、input()输入输出、映射函数map()结合input()和split()函数实现多值输入
【Python零基础入门篇 · 2】:掌握各种运算符和变量、input()输入输出、映射函数map()结合input()和split()函数实现多值输入
122 0
【Python零基础入门篇 · 2】:掌握各种运算符和变量、input()输入输出、映射函数map()结合input()和split()函数实现多值输入
Python input 将输入的多个数据变成数组list(输入多个省份)
Python input 将输入的多个数据变成数组list(输入多个省份)
Python input 将输入的多个数据变成数组list(输入多个省份)
|
开发者 Python
input() 函数|学习笔记
快速学习 input() 函数
177 0