首页 新闻 会员 周边 捐助

关于C语言结构体方面

0
悬赏园豆:50 [待解决问题]

#include <stdio.h>
#include <stdlib.h>
struct mangement
{
char *name;
int S_num;
char Dor;
int room_num;
};
struct mangement stu[12]={{"LZJ",201725,'A',101},
{"NPC",201726,'A',101},
{"LZW",201727,'A',201},
{"LZZ",201728,'A',201},
{"LJZ",201729,'B',101},
{"JLZ",201730,'B',101},
{"JJL",201731,'B',201},
{"LKJ",201732,'B',201},
{"WWY",201733,'C',101},
{"YZF",201734,'C',101},
{"YFZ",201735,'C',201},
{"AWE",201736,'C',201}};
int main()
{
char Dor;
int room_num;
struct mangement *p;
printf("请输入宿舍号:\n");
scanf("%c%d",&Dor,&room_num);
for(p=stu;p<stu+12;p++)
if((Dor==p->Dor)&&(room_num==p->room_num))
printf("该宿舍的学生名字为:%s\n%s的学号为:%s\n",p->name,p->name,p->S_num);
return 0;
}

c
bboy–志杰的主页 bboy–志杰 | 初学一级 | 园豆:136
提问于:2018-06-27 15:56
< >
分享
所有回答(2)
0

问题是啥呢?

我非英雄 | 园豆:250 (菜鸟二级) | 2018-06-27 20:37

运行不出来

支持(0) 反对(0) bboy–志杰 | 园豆:136 (初学一级) | 2018-06-28 20:06

学号为int类型,输出格式应为%d

支持(0) 反对(0) 我非英雄 | 园豆:250 (菜鸟二级) | 2018-06-30 09:16
0

已解决已解决

bboy–志杰 | 园豆:136 (初学一级) | 2018-08-05 12:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册