精品word学习资料可编辑
名师归纳总结——欢迎下载
# inclu de<stdi o,h〉
#in clud e〈stdlib,h
#i ncludestring,h〉typedefstruc t Stud ent{
char name [20]; char sex [5]; int age ;
cha r institute[2 0];
char speci alty[30 ];
}Studen t; typedefstruct Room{
int roomnum; int room area; int totalnum; i nt st unu m; Stu dent stu[10]; Ro om *next;
} Room;
typed ef struct Story{
cha r st orynum; Room *room;
}Story ;
/* -——-- ——— --——-—-—-—-—-— ---—--—-- ——— ---—- -
-- ---—--- --- ----- ---—-— -——— - ---—- -—-—-- —-—-- —-——-
——— --—--*/
Student *StudentCreat(i nt age,char name[], char inst itute
[],char spe cialty[] ,char sex[])
{
Stud ent *Stu;
Stu=(Stude nt *)mal loc(sizeof(S tuden t)); Stu->a ge=a ge;
strcp y(Stu-〉institute,instit ute); strcpy (Stu-〉n ame,na me);
st rcpy(Stu->spec ialty, sp ecialty) ; st rcpy( Stu— sex,sex );
return Stu;
}
Room * RoomC re at(int room_num,in t room_ar ea,i nt total_num,
i nt stu_ num)
{
Roo m *R ; int i;
R=(Room *) mal loc(sizeof( Room)); if (.R)return NULL;
精品word学习资料可编辑
名师归纳总结——欢迎下载
R->roomnum=room _num ; R—roomarea=room_area; R-〉t ota lnum=total_num;
R-stunum=stu _nu m;
R-〉n ex t= NULL ;
return R;
}
Story *Stor yCreat()
{
Sto ry *S;
S=(Story *) mallo c(sizeof(Story) ); S—room=RoomCreat(0, 0,0,0); return S;
}
St ory * DormCreat()
{
Story * S, * c ontr ol; char i;
control= (Story * )malloc(2 6* sizeof(Stor y));
if(! control) ret urn NULL;
精品word学习资料可编辑
名师归纳总结——欢迎下载
for(i=’ Ai;
{
=Z’i;++ )
精品word学习资料可编辑
名师归纳总结——欢迎下载
S= St or yCreat(); S-storynum =i;
精品word学习资料可编辑
名师归纳总结——欢迎下载
control[i —’ A]
}
=*S;
精品word学习资料可编辑
名师归纳总结——欢迎下载
return control ;
}
/* - --————— --———— -—————— - --— -—-—-- ---- ---- --
--—---- ---- —--—-- ---——— ---—- -—-------- -—— ----- -—— -—-
-——— */
Story * Sto rySe ar ch(S tory *control ,char st orynu m)
{
re turn control+( storynum- A ’;)
}
Room * RoomSe arch(Ro om *R ,int ro om_num)
{
while( R—〉next!=NULL)
{
if (R-〉n ext->r oomnum= =r oom_nu m)break; else R=R- >next;
}
retu rn R;
}
精品word学习资料可编辑
名师归纳总结——欢迎下载
Student *Stud entSeacr
{
h (Roo m
您可能关注的文档
- 厂家和经销商代理合同范本.docx
- 电梯安装工程承包合同范本.docx
- 独家代理协议.docx
- 防水工程旁站监理记录.docx
- 房地产项目目标成本及控制责任书.docx
- 【方案】彩色混凝土施工方案.docx
- 【方案】盖梁穿心棒方案.docx
- 【设计】新建更衣室施工组织设计.docx
- 【设计】浙江省公路初步设计审查要点.docx
- Linux张同光版课后习题答案.docx
- 2025-2026学年天津市和平区高三(上)期末数学试卷(含解析).pdf
- 2025-2026学年云南省楚雄州高三(上)期末数学试卷(含答案).pdf
- 2025-2026学年甘肃省天水市张家川实验中学高三(上)期末数学试卷(含答案).docx
- 2025-2026学年福建省厦门市松柏中学高二(上)期末数学试卷(含答案).docx
- 2025-2026学年广西钦州市高一(上)期末物理试卷(含答案).docx
- 2025-2026学年河北省邯郸市临漳县九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省石家庄二十三中七年级(上)期末历史试卷(含答案).docx
- 2025-2026学年海南省五指山市九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省唐山市玉田县九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省邢台市市区九年级(上)期末化学试卷(含答案).docx
原创力文档

文档评论(0)