游客 Signup | Login
中文 | En

3044 - 【设计型】第12章:结构体与共同体 例7 向函数传递结构体(1)

定义一个学生结构体,数据成员包括学号,姓名,性别,生日(年月日),然后编写一个输出函数输出1个同学的数据。

注:要求用结构体做函数参数。

Input

Output

一行输出一个同学的数据。

Examples

Input

no input needed

Output

1001011 王丽 F 1995/10/12

Solution C

#include<stdio.h> 
struct student 
{
long num;
char name[20];
char sex;
int year;
int month;
int day;	
}; 
void display (struct student s)
{
			   	printf("%ld %s %c %d/%d/%d\n",s.num,s.name,s.sex,
				   s.year,s.month,s.day);	
}
int main()
{
struct student stu={1001011,"王丽",'F',1995,10,12        
               };
              display(stu); 
			   return 0;	
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题