基于LINUX系统下c语言学生管理系统stuWord文档格式.docx
《基于LINUX系统下c语言学生管理系统stuWord文档格式.docx》由会员分享,可在线阅读,更多相关《基于LINUX系统下c语言学生管理系统stuWord文档格式.docx(14页珍藏版)》请在冰豆网上搜索。
{(*index)=1;
while(p!
=NULL)
{
if(p->
stu_info.num==s->
stu_info.num)
{
strcpy(s->
stu_info.name,p->
stu_info.name);
s->
stu_info.sex=p->
stu_info.sex;
stu_info.age=p->
stu_info.age;
class=p->
class;
chi=p->
chi;
math=p->
math;
eng=p->
eng;
password,p->
password);
rank=p->
rank;
next=NULL;
returns;
}
p=p->
next;
(*index)++;
}
returnNULL;
}
/**********************************************/
/*
*说明:
先查找,将查找到的结点返回
**/
linkstustu_searchmyinfo_1(linkstuphead,intnum)
linkstup=phead;
{
while(p!
{
if(p->
stu_info.num==num)
returnp;
p=p->
}
/**************************************按序号查找学生************************************************/
linkstustu_searchbyindex(linkstuphead,intindex)
inti;
if(phead==NULL||index>
link_getlen(phead)||index<
1)
for(i=1;
i<
index;
i++)
returnp;
/*********************************学生修改自己的密码*********************************************/
voidstu_modmypass(linkstumod_p)
chara[10],b[10];
if(mod_p!
printf("
Oldpassword:
%s\n"
mod_p->
while
(1)
printf("
请输入新密码:
"
scanf("
%s"
b);
请再次确认输入的新密码:
a);
if(strcmp(b,a)==0)
{
strcpy(mod_p->
password,a);
printf("
修改成功!
break;
else
两次输入不一样,修改失败,请重新输入!
getchar();
}
/**************************************************创建学生信息链表********************************************/
/***创建形式:
尾插
**功能:
返回头指针
**
linkstustu_link_creat()
linkstus=NULL,phead=NULL,r;
intflag=1;
intnum,age,class,chi,math,eng;
charname[10],sex;
charsym;
while
(1)
请输入学号(务必输入1000-4000之间的数):
"
scanf("
%d"
&
num);
if(num>
=1001&
&
num<
4000)
break;
else
输入有误,重新输入!
printf("
请输入姓名:
scanf("
name);
getchar();
//************************************************吸收掉输入姓名后敲入的回车
请输入性别(f,F或者m,M):
%c"
sex);
if(sex=='
f'
||sex=='
F'
m'
M'
)
}
请输入年龄(务必输入20-30之间的数):
age);
if(age>
=20&
age<
=30)
请输入班级(务必输入1-3之间的整数):
class);
if(class>
=1&
class<
=3)
while
(1)
请输入语文成绩(0-100之间的数):
chi);
if(chi>
=0&
chi<
=100)
请输入数学成绩:
math);
if(math>
math<
{
请输入英语成绩:
eng);
if(eng>
eng<
while(flag)
s=(linkstu)malloc(sizeof(nodestu));
if(s==NULL)
%s,%d"
__FILE__,__LINE__);
returnNULL;
s->
strcpy(s->
stu_info.name,name);
//***************字符串不能直接赋给字符串,需要用此方式赋值
stu_info.sex=sex;
stu_info.age=age;
class=class;
chi=chi;
math=math;
eng=eng;
if(phead==NULL)
s->
phead=s;
r=s;
r->
next=s;
getchar();
DoYouWantcontinue?
Y/N"
while
(1)
sym=getchar();
if(sym=='
y'
||sym=='
Y'
{
flag=1;
while
(1)
scanf("
if(num>
break;
else
printf("
//******************************************吸收掉输入姓名后敲入的回车
if(sex=='
{
getchar();
}
}
if(age>
if(class>
while
(1)
请输入语文成绩(0-100之间的数):
if(chi>
if(math>
if(eng>
break;
}
elseif(sym=='
n'
N'
flag=0;
else
returnphead;
/******************************************求学生链表长度**************************************************/
intlink_getlen(linkstuphead)
intlen=0;
while(p!
len++;
p=p->
returnlen;
/*****************************************************************************************/
/********************************打印学生信息的函数*************************************/
voidlink_stu_print(linkstuphead)
无任何学生信息!
return;
\n\t\t\t\t学生成绩信息\n\n"
学号\t姓名\t性别\t年龄\t班级\t语文成绩数学成绩英语成绩\n"
%d\t%s\t%c\t%d\t%d\t%d\t%d\t\t%d\n"
p->
stu_info.num,p->
stu_info.sex,p->
stu_info.age,p->
class,p->
chi,p->
math,p->
End\n"
/**********************************************初始化学生的登录密码123**********************************************/
voidinitial_stu_password(linkstuphead)
emptylink!
return;
strcpy(p->
password,"
123"
/*************************************学生输入密码登录****************************************************/
intstu_login(linkstuphead)
intq=0,fre=0;
charpassword[10];
linkstup;
p=phead;
fre++;
\n请输入学生学号:
stu_num);
请输入学生密码:
password);
stu_info.num==stu_num&
(strcmp(p->
password,password)==0))
q=1;
if(q==1)
登录成功!
sleep
(2);
if(fre==3)
登录失败!
退出系统\n"
输入有误,请重新输入:
if(q==1)
return1;
return-1;