您的wps商业版授权码不正确,请联系商务获取正确的授权码【apkplug-business-auth】

linux终端版学生信息管理系统【C语言实现】_-IT行业第一站
linux终端版学生信息管理系统【C语言实现】
linux终端版学生信息管理系统【C语言实现】
标题:linux终端版学生信息管理系统【C语言实现】
/*----------------------------------------------------------------------------------------- 程序名:stu_management.c 程序功能:
1.鉴别root权限,设置管理员和学生权限,管理员和学生可以异步登录
(如果加入网络模块就可以实现多用户同步登录)
2.管理员可以设置/查询/修改学生所有账户信息,也可以增加新的管理员
3.学生只有查询账户/课程/奖学金的权限
4.自动生成配置文件,退出时并保存配置文件,防止信息丢失
5.移植程序只需将可执行程序和配置文件移植即可,信息不会丢失 程序实现:采用链表加文件操作库函数结合过程控制实现 编译:gcc stu_management.c -o stu_management 编译环境:gcc 版本 4.5.1
(Red Hat 4.5.1-4) (GCC)
作者:张峰
[mailto:] 修改日期: -----------------------------------------------------------------------------------------*/ #include &stdio.h& #include &stdlib.h& #include &string.h& #include &unistd.h& #define N 3
//课程和奖学金种类的总数量和
typedef struct SCORE{
char course_name[32]; }S
typedef struct node{
char usr_name[32];
char password[18];
char stu_name[32];
char major[32];
Score s[N];
struct node* }N
Node *head,* int usr_ char usr_name[32],password[18]; const char* f_name="usr_info.conf";
void load_data(),save_data(),export_data(),check_admin(),add_admin(),login(); void add_student(),search_student(),del(),modify(),modify_password(),logout(); void show_score(),search_course();
void title_win(),msg_win();
int main() {
load_data();
title_win();
check_admin();
printf("请选择用户类型:");
scanf("%d",&usr_type);
if(usr_type!=1 && usr_type!=2)
msg_win("没有该用户类型,请重新输入,1表示admin,2表示studentn");
if(usr_type==1)
title_win();
msg_win("User Type:Admin");
msg_win("Add/Srch/Del/Mdfy/M_Psd/Quit/Exp/Save");
printf("&");
scanf("%d",&ch);
switch(ch)
case 1:add_student();
case 2:search_student();
case 3:del();
case 4:modify();
case 5:modify_password();
case 6:logout();
case 7:export_data();
case 8:save_data();
case 9:add_admin();
getchar();
msg_win("按任意键返回");
getchar();
system("clear");
title_win();
msg_win("User Type:Student");
msg_win("ShowScore/SrchCourse/M_Pwd/Quit");
printf("&");
scanf("%d",&ch);
switch(ch)
case 1:show_score();
case 2:search_course();
case 3:modify_password();
case 4:logout();
getchar();
msg_win("按任意键返回");
getchar();
system("clear");
return 0; }
void load_data() {
FILE* fp=NULL;
if(!(fp=fopen(f_name,"a")))
msg_win("Open file fail");
fclose(fp);
if(!(fp=fopen(f_name,"r+")))
msg_win("Open file fail");
p=(Node*)malloc(sizeof(Node));
if(!fread(p,sizeof(Node),1,fp))
if(head==NULL)
head=last=p;
head-&next=NULL;
last-&next=p;
last-&next=NULL;
fclose(fp);
void save_data() {
FILE* fp=NULL;
if(!(fp=fopen(f_name,"w+")))
msg_win("Open file fail");
fwrite(p,sizeof(Node),1,fp);
fclose(fp);
fp=NULL; }
void export_data() {
if(!(fp=fopen("export.log","w+")))
msg_win("Open file fail");
fprintf(fp,"%-2d|%-15s|%-18s|%-15s|%-10d|%-18s|n",p-&auth,p-&usr_name,p-&password,p-&stu_name,p-&id,p-&major);
for(i=0;i&N;i++)
fprintf(fp,"%s:%-5.1f|",p-&s[i].course_name,p-&s[i].score);
fprintf(fp,"n");
fclose(fp); }
void check_admin() {
if(p-&auth==1)
p=(Node*)malloc(sizeof(Node));
p-&auth=1;
msg_win("请设置管理员账户");
printf("用户名:");
scanf("%s",p-&usr_name);
printf("密码:");
scanf("%s",p-&password);
if(head==NULL)
head=last=p;
head-&next=NULL;
last-&next=p;
last-&next=NULL;
msg_win("管理员账户设置成功");
system("clear"); }
void add_admin() {
p=(Node*)malloc(sizeof(Node));
p-&auth=1;
msg_win("添加管理员账户");
printf("用户名:");
scanf("%s",p-&usr_name);
printf("密码:");
scanf("%s",p-&password);
if(head==NULL)
head=last=p;
head-&next=NULL;
last-&next=p;
last-&next=NULL;
msg_win("新管理员账户设置成功");
void login() { login: system("clear");
msg_win("登录");
printf("用户名:");
scanf("%s",usr_name);
printf("密码:");
scanf("%s",password);
if(!strcmp(p-&usr_name,usr_name) && !strcmp(p-&password,password) && p-&auth==usr_type)
msg_win("登录成功");
system("clear");
msg_win("用户名或密码不正确,按任意键重新登录");
getchar();getchar(); }
void add_student() {
Node* p=(Node*)malloc(sizeof(Node));
p-&auth=2;
msg_win("添加学生账户");
printf("用户名:");
scanf("%s",p-&usr_name);
printf("密码:");
scanf("%s",p-&password);
printf("姓名:");
scanf("%s",p-&stu_name);
printf("学号:");
scanf("%d",&(p-&id));
printf("专业:");
scanf("%s",p-&major);
if(head==NULL)
head=last=p;
head-&next=NULL;
last-&next=p;
last-&next=NULL;
msg_win("学生账户设置成功"); }
void search_student() {
msg_win("搜索账户信息");
int stu_id,i;
printf("请输入学号:");
scanf("%d",&stu_id);
if(p-&id==stu_id)
printf("%d %s %s %s %d %sn",p-&auth,p-&usr_name,p-&password,p-&stu_name,p-&id,p-&major);
for(i=0;i&N;i++)
printf("%s:%-5.1f",p-&s[i].course_name,p-&s[i].score);
printf("n");
msg_win("系统中没有该学号"); }
void del() {
Node *p,*q;
msg_win("删除账户信息");
printf("请输入学号:");
scanf("%d",&stu_id);
if(p-&id==stu_id)
if(head==p)
head=head-&
q-&next=p-&
msg_win("删除成功!");
msg_win("删除失败!系统中没有该学号");
void modify() {
int stu_id,i;
msg_win("修改课程成绩和奖学金");
printf("请输入学号:");
scanf("%d",&stu_id);
if(p-&id==stu_id)
for(i=0;i&N;i++)
scanf("%s %f",p-&s[i].course_name,&(p-&s[i].score));
msg_win("系统中没有该学号");
void modify_password() {
char temp[18],new_password[18];
msg_win("修改密码");
printf("请输入旧密码:");
scanf("%s",temp);
printf("请输入新密码:");
scanf("%s",new_password);
printf("请确认新密码:");
scanf("%s",password);
if(!strcmp(usr_name,p-&usr_name))
if(!strcmp(p-&password,temp)&& !strcmp(new_password,password))
strcpy(password,new_password);
strcpy(p-&password,password);
msg_win("密码修改成功");
msg_win("输入有误,自动退出");
void logout() {
save_data();
msg_win("成功退出");
exit(1); }
void show_score() {
msg_win("所有课程成绩和奖学金");
if(!strcmp(usr_name,p-&usr_name))
printf("%d %s %s %s %d %sn",p-&auth,p-&usr_name,p-&password,p-&stu_name,p-&id,p-&major);
for(i=0;i&N;i++)
printf("%s:%-5.1f",p-&s[i].course_name,p-&s[i].score);
printf("n");
void search_course() {
char course_name[32];
msg_win("输入要查询的课程");
printf("&");
scanf("%s",course_name);
if(!strcmp(usr_name,p-&usr_name))
for(i=0;i&N;i++)
if(!strcmp(course_name,p-&s[i].course_name))
printf("%s:%-5.1fn",p-&s[i].course_name,p-&s[i].score);
char str1[]="Student Information Management System";
void title_win() {
M=strlen(str1);
for(i=0;i&M;i++)
printf("-");
printf("n");
printf("%sn",str1);
for(i=0;i&M;i++)
printf("-");
printf("n"); }
void msg_win(const char* str) {
M=strlen(str1);
printf("n");
printf("%sn",str);
for(i=0;i&M;i++)
printf("-");
printf("n");
2.配置文件 && 配置文件自动生成,在用户当前目录下面,名为usr_info.conf的文件,如果需要移植程序到其他主机上运行而又想数据转移,那么将可执行程序和配置文件一起移植即可
3.效果图 a. 注册root账户
c. admin添加学生账户信息
d. admin添加和修改学生课程成绩和奖学金
e. admin查看学生信息
f. admin或学生修改登录密码
g. 学生账户登录后查询账户信息
h. 学生查询单科成绩
延伸阅读:
热门搜索:
特色栏目:
类别推荐:.手机为什么会出这样的字?(你的商业版权码不正确,请联系商务获取正确的授权码)_百度知道
.手机为什么会出这样的字?(你的商业版权码不正确,请联系商务获取正确的授权码)
这是一道待解决的难题
您的回答被采纳后将获得系统奖励20(财富值+经验值)+难题奖励30(财富值+经验值)
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁apkplug授权码不正确怎么回事_百度知道
apkplug授权码不正确怎么回事
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 apkplug 的文章

 

随机推荐