c语言小组实验Word格式文档下载.docx
- 文档编号:21318727
- 上传时间:2023-01-29
- 格式:DOCX
- 页数:52
- 大小:46.20KB
c语言小组实验Word格式文档下载.docx
《c语言小组实验Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《c语言小组实验Word格式文档下载.docx(52页珍藏版)》请在冰豆网上搜索。
3.学生信息浏览功能---输出。
2.小组分工和每位组员的贡献说明
张颖:
负责会议安排,讨论内容,确定课题题目。
张光超:
负责查找资料,及参考文献,搜集材料。
张晓敏:
负责心得体会,以及程序调试。
孙亭亭:
负责设计,功能分析,效果贴图。
3.需求分析与功能设计
程序设计组成框图:
姓名:
地址:
学号:
手机号:
出生月:
出生日:
功能设计:
根据主菜单选择是否进入程序(利用if语句实现)
进入学生信息输入界面(利用scanf输入while循环)
源程序:
#include<
stdio.h>
string.h>
stdlib.h>
dos.h>
#include"
conio.h"
structstudent
{
charname[20];
charadd[20];
charnum[11];
chartel[12];
charshorttel[8];
charqq[11];
charmonth[3];
charday[3];
structstudent*next;
};
structstudent*creat(structstudent*head);
structstudent*record();
structstudent*search(structstudent*head,charch);
structstudent*insert(structstudent*head);
structstudent*load();
voidprintall(structstudent*temp);
voidprint(structstudent*temp);
voidmainmenu();
voideditmenu(structstudent*head);
voidsearchmenu(structstudent*head);
voidamendmenu(structstudent*temp);
voidsavefile(structstudent*head);
structstudent*delmenu(structstudent*head);
intcheck(charstrs[],intlen,intz);
charfilename[256];
structstudent*creat(structstudent*head)
structstudent*p1,*p2=NULL;
p1=p2=(structstudent*)malloc(sizeof(structstudent));
p1=record();
head=p1;
while(p1!
=NULL)
{
charch;
printf("
\n******CreatSuccess!
!
******\n"
);
\nEntertocontinue,otherkeytoreturn!
\n"
ch=getch();
if(ch!
=13)break;
p2->
next=p1;
p2=p1;
p1=(structstudent*)malloc(sizeof(structstudent));
}
next=NULL;
\n\nFinsh!
Pressanykeytoeditit!
"
getch();
returnhead;
}
intcheck(charstrs[],intlen,intz)
inti=0;
if(strlen(strs)>
len){printf("
Illegelinput!
Pleaseinputagain!
\n"
return0;
if(z==1)
while(strs[i]!
='
\0'
)
if(strs[i]<
48||strs[i]>
58){printf("
i++;
return1;
structstudent*record()
structstudent*temp;
charstrs[30];
temp=(structstudent*)malloc(sizeof(structstudent));
do
Pleaseinputthestudent'
sname:
scanf("
%s"
strs);
}while(!
check(strs,20,0));
strcpy(temp->
name,strs);
saddress:
add,strs);
snumber:
check(strs,10,1));
num,strs);
smobilenumber:
check(strs,11,1));
tel,strs);
sshorttelnumber:
check(strs,6,1));
shorttel,strs);
sqqnumber:
qq,strs);
sbornmonth:
check(strs,2,1));
month,strs);
sbornday:
day,strs);
fflush(stdin);
returntemp;
structstudent*load()
structstudent*head,*temp,*temp1;
FILE*fp;
charstrs[20];
head=NULL;
temp1=(structstudent*)malloc(sizeof(structstudent));
Pleaseinputthefilename:
(student)"
filename);
if((fp=fopen(filename,"
rt"
))==NULL)
Systemcan'
tfindthefile!
returnNULL;
ch=fgetc(fp);
while(ch!
=EOF)
=-2)
strs[i]=ch;
strs[i]='
;
i=0;
if(head==NULL)head=temp;
else
temp1->
next=temp;
temp1=temp;
temp->
fclose(fp);
Loadsuccess!
Pressanykeytocontinue!
voidsavefile(structstudent*head)
if(filename[0]=='
){printf("
scanf("
fp=fopen(filename,"
wt"
while(head!
while(head->
name[i]!
fputc(head->
name[i],fp);
fputc(254,fp);
add[i]!
add[i],fp);
num[i]!
num[i],fp);
tel[i]!
tel[i],fp);
shorttel[i]!
shorttel[i],fp);
qq[i]!
qq[i],fp);
month[i]!
month[i],fp);
day[i]!
day[i],fp);
head=head->
next;
Savesuccess!
voidprint(structstudent*temp)
********************************************************************************"
Thestudent'
snameis:
%s\n"
temp->
name);
saddressis:
add);
snumberis:
num);
smobilenumberis:
tel);
sshorttelnumberis:
shorttel);
sqqnumberis:
qq);
sbirthdayis:
%s,%sth\n"
month,temp->
day);
voidprintall(structstudent*head)
if(head==NULL)
Systemisempty!
return;
print(head);
if(i>
1){getch();
i=0;
structstudent*insert(structstudent*head)
structstudent*temp=head,*temp1=NULL;
while
(1)
head=creat(head);
while(temp->
next!
temp=temp->
temp1=record();
next=temp1;
\nInsertthestudent'
ssuccess!
PressEntertocontinue!
Otherkeytoreturn!
if(ch==13);
structstudent*search(structstudent*head,charch)
switch(ch)
case'
a'
:
Pleaseinputthestudent'
if(strcmp(head->
name,strs)==0)
tfind%s'
simformation!
b'
add,strs)==0)
tfindtheaddress!
c'
num,strs)==0)
tfindthenumber!
d'
smobilephonenumber:
tel,strs)==0)
tfindthemobilephonenumber!
e'
sshortnumber:
shorttel,strs)==0)returnhead;
tfindtheshortnumber!
f'
qq,strs)==0)returnhead;
tfindtheqqnumber!
g'
Pleaseinputthemonth:
Pleaseinputtheday:
day);
month,strs)==0&
&
strcmp(head->
day,day)==0)returnhead;
tfindthebirthday!
default:
voidmainmenu()
structstudent*head=NULL;
puts("
\nWelcometoStudentImformationSystem!
Mainmenu\n"
[a]Creatnewstudentimformationfile;
[b]Loadthestudentimformationfile;
[c]About.....\n"
[d]ExitSystem!
\n********************************
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 小组 实验
![提示](https://static.bdocx.com/images/bang_tan.gif)