#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;
}
问题是啥呢?
运行不出来
学号为int类型,输出格式应为%d
已解决已解决