如果觉得对你有帮助,能否点个赞或关个注,以示鼓励笔者呢?!博客目录 | 先点这里
偶然翻到了自己大一时候写的一些代码,代码冗余,但还是想保存下来,以作纪念。
1.运行效果
2.运行环境
源码(Dev5.4.0版本下可直接(.cpp文件)运行 gcc 4.7.2)
注意:由于部分代码为C11标准,后缀名应改为cpp运行 编译器下载链接:https://pan.baidu.com/s/1Hywq6hxzxMzX1-22ig2HdA 提取码:kd65 下载后解压即可使用
3.完整代码
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
typedef struct student
{
char sno[30];
char name[30];
char sex[5];
char native[30];
int scores[10];
int sum_scores;
int flag;
struct student* next;
}Stu,* pStu;
pStu Stu_Head;
int flag;
int LEN;
char UI_1[20][140]={
{"****************欢迎来到学生信息管理系统****************"},
{"****************按下以下按键即可呼出选择****************"},
{"********************1.学生信息录入**********************"},
{"********************2.添加学生信息**********************"},
{"********************3.删除学生信息**********************"},
{"********************4.修改学生信息**********************"},
{"********************5.学生信息排序**********************"},
{"********************6.学生信息查找**********************"},
{"********************7.学生信息筛选**********************"},
{"********************8.保存修改(存盘)********************"},
{"********************9.显示所有学生信息******************"},
{"********************10.还原系统*********************"},
{"********************0.退出******************************"},
{"————————————————————————————————————————————————————————————————"}
};
char UI_2[10][140]={
{"****************按下以下按键即可呼出选择****************"},
{"********************1.按学号排序************************"},
{"********************2.按姓名排序************************"},
{"********************3.按总成绩排序**********************"},
{"********************0.退出******************************"},
{"————————————————————————————————————————————————————————————————"}
};
char UI_3[10][140]={
{"****************按下以下按键即可呼出选择****************"},
{"********************1.通过学号查找**********************"},
{"********************2.通过姓名查找**********************"},
{"********************3.通过性别查找**********************"},
{"********************4.通过籍贯查找**********************"},
{"********************0.退出******************************"},
{"————————————————————————————————————————————————————————————————"}
};
char UI_4[10][140]={
{"****************按下以下按键即可呼出选择****************"},
{"********************1.筛选平均成绩优秀的学生************"},
{"********************2.筛选单科不及格的学生**************"},
{"********************0.退出******************************"},
{"————————————————————————————————————————————————————————————————"}
};
char cartoon[5][140]={
{"******************正在进入学生管理界面******************"},
{" _____________________ "},
{" │ │ "},
{" └────────────────────┘ "}
};
void creat_stu();
void show_stu();
void add_stu();
void del_stu();
void mod_stu();
void save_stu();
int len_stu();
void file_len();
void restore_system();
void sort_by_sno();
void sort_by_name();
void sort_by_scores();
void find_by_sno();
void find_by_name();
void find_by_sex();
void find_by_native();
void screen_by_good();
void screen_by_fail();
void top_menu_1();
void top_menu_2();
void top_menu_3();
void top_menu_4();
void choice_menu();
void choice_submenu_1();
void choice_submenu_2();
void choice_submenu_3();
void go();
void gotoxy(int,int);
void load_cartoon();
void regis();
void login();
int len_regis();
void go()
{
printf("%*s",68,"");
}
void gotoxy(int x, int y)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(handle, pos);
}
void regis()
{
int i=0;
char ch;
char username[25];
char password[25];
char re_password[25];
FILE *fp;
fp=fopen("账号密码.txt","a+");
go();
printf("********************管理员账号注册*******************\n");
go();
printf("请输入您要注册的账号:");
scanf("%s",username);
go();
printf("请输入密码:");
while((ch=getch())!=13){
password[i++]=ch;
printf("%c",ch);
Sleep(200);
putchar(8);
printf("*");
}
password[i]='\0';
printf("\n");
go();
printf("请再次输入密码:");
i=0;
while((ch=getch())!=13){
re_password[i++]=ch;
printf("%c",ch);
Sleep(150);
putchar(8);
printf("*");
}
re_password[i]='\0';
printf("\n");
if(!strcmp(password,re_password)){
if(fprintf(fp,"%s\t%s\n",username,password))
{
go();
printf("注册成功!\n");
}
else{
go();
printf("注册失败!请重新注册!\n");
regis();
return ;
}
}
else{
go();
printf("两次密码输入不一致!请重新注册!\n");
regis();
return ;
}
fclose(fp);
}
int len_regis()
{
FILE *fp;
int i=0;
char a[30],b[30];
fp=fopen("账号密码.txt","r");
while(2==fscanf(fp,"%s%s",a,b))i++;
fclose(fp);
return i;
}
void login()
{
char input_username[25];
char input_password[25];
char read_username[25];
char read_password[25];
int i=0;
flag=0;
char ch;
FILE *fp;
go();
printf("********************管理员账号登录*******************\n");
go();
printf("账号:");
scanf("%s",input_username);
go();
printf("密码:");
while((ch=getch())!=13){
input_password[i++]=ch;
printf("%c",ch);
Sleep(150);
putchar(8);
printf("*");
}
input_password[i]='\0';
printf("\n");
fp=fopen("账号密码.txt","r");
for(i=0;i<len_regis();i++)
{
fscanf(fp,"%s%s",read_username,read_password);
if(!strcmp(input_username,read_username)&&!strcmp(input_password,read_password))
flag=1;
}
if(flag){
go();
printf("登录成功!\n");
}
if(!flag){
go();
printf("账号或密码输入错误!请重新登录\n");
login();
}
fclose(fp);
}
void restore_system()
{
FILE *fp;
int i;
char sno[13][25]={
{"001"},{"002"},{"003"},
{"004"},{"005"},{"006"},
{"007"},{"008"},{"009"},
{"010"},{"011"},{"012"}};
char name[13][25]={
{"阿良"},{"齐静春"},{"李淳罡"},
{"徐骁"},{"韩貂寺"},{"曹长卿"},
{"陈芝豹"},{"温华"},{"韩生宣"},
{"轩辕城"},{"徐凤年"},{"柴青山"}};
char sex[13][5]={
{"男"},{"男"},{"女"},
{"女"},{"女"},{"男"},
{"男"},{"男"},{"女"},
{"男"},{"男"},{"男"}};
char native[13][20]={
{"宜昌"},{"上海"},{"北京"},
{"武汉"},{"天津"},{"广州"},
{"深圳"},{"重庆"},{"西安"},
{"成都"},{"苏州"},{"杭州"}};
fp=fopen("student.txt","w");
if(fp==NULL){
printf("\t文件打开失败!\n");
exit(-1);
}
for(i=0;i<12;i++)
{
int scores[3]={rand()%50+50,rand()%40+60,rand()%60+40};
fprintf(fp,"%-5s %-10s %-5s %-15s %2d %2d %2d %2d\n",
sno[i],name[i],sex[i],native[i],scores[0],scores[1],scores[2],
scores[0]+scores[1]+scores[2]);
}
fclose(fp);
creat_stu();
}
void file_len()
{
LEN=0;
FILE *fp;
char sno[30];
char name[30];
char sex[5];
char native[30];
int scores[10];
int sum;
fp=fopen("student.txt","r");
if(fp==NULL){
printf("\t文件打开失败!\n");
exit(-1);
}
while(8==fscanf(fp,"%s%s%s%s%d%d%d%d",
sno,name,sex,native,&scores,&scores,&scores,&sum))LEN++;
}
int len_stu()
{
int len=0;
pStu p=Stu_Head->next;
while(p!=NULL)
{
p=p->next;
len++;
}
return len;
}
void creat_stu()
{
int i=0;
FILE *fp;
fp=fopen("student.txt","r");
if(fp==NULL){
printf("\t文件打开失败!\n");
exit(-1);
}
Stu_Head=(pStu)malloc(sizeof(Stu));
pStu pTail=Stu_Head;
pTail->next=NULL;
file_len();
for(i=0;i<LEN;i++)
{
pStu pNew=(pStu)malloc(sizeof(Stu));
fscanf(fp,"%s%s%s%s%d%d%d%d",pNew->sno,pNew->name,pNew->sex,
pNew->native,&pNew->scores[0],&pNew->scores[1],
&pNew->scores[2],&pNew->sum_scores);
pTail->next=pNew;
pNew->next=NULL;
pTail=pNew;
}
fclose(fp);
}
void show_stu()
{
pStu p=Stu_Head->next;
int i=1;
printf("\t序号\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
while(p!=NULL)
{
printf("\t%-3d\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
i++,p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
p=p->next;
}
}
void add_stu()
{
int i=0,n,c;
pStu p=Stu_Head->next;
while(p->next!=NULL)p=p->next;
go();
printf("请输入您要添加的学生数:");
scanf("%d",&n);
for(i=0;i<n;i++){
pStu pNew=(pStu)malloc(sizeof(Stu));
go();
printf("请输入添加的第%d个学生的学号:",i+1);
scanf("%s",pNew->sno);
go();
printf("请输入添加的第%d个学生的姓名:",i+1);
scanf("%s",pNew->name);
go();
printf("请输入添加的第%d个学生的性别:",i+1);
scanf("%s",pNew->sex);
go();
printf("请输入添加的第%d个学生的籍贯:",i+1);
scanf("%s",pNew->native);
go();
printf("请输入添加的第%d个学生的高等数学成绩:",i+1);
scanf("%d",&pNew->scores[0]);
go();
printf("请输入添加的第%d个学生的线性代数成绩:",i+1);
scanf("%d",&pNew->scores[1]);
go();
printf("请输入添加的第%d个学生的大学英语成绩:",i+1);
scanf("%d",&pNew->scores[2]);
pNew->sum_scores=pNew->scores[0]+pNew->scores[1]+pNew->scores[2];
p->next=pNew;
pNew->next=NULL;
p=pNew;
}
}
void del_stu()
{
int i=0,n;
pStu p=Stu_Head;
pStu m;
show_stu();
go();
printf("请输入要删除的学生序号:");
scanf("%d",&n);
while(p!=NULL&&i<n-1)
{
p=p->next;
i++;
if(i>len_stu())
{
go();
printf("输入错误!要删除的学生不存在!\n");
break;
}
}
m=p->next;
p->next=p->next->next;
free(m);
}
void mod_stu()
{
int i=1,n,c;
pStu p=Stu_Head->next;
show_stu();
go();
printf("请输入您要修改的学生的序号:");
scanf("%d",&n);
for(i=1;i<n;i++)p=p->next;
if(i>len_stu()){
go();
printf("未能查询到该学生,请检查输入是否有误!\n");
}
else{
go();
printf("修改该学生的学生的学号为:",i+1);
scanf("%s",p->sno);
go();
printf("修改该学生的学生的姓名为:",i+1);
scanf("%s",p->name);
go();
printf("修改该学生的学生的性别为:",i+1);
scanf("%s",p->sex);
go();
printf("修改该学生的学生的籍贯为:",i+1);
scanf("%s",p->native);
go();
printf("修改该学生的学生的高等数学成绩为:",i+1);
scanf("%d",&p->scores[0]);
go();
printf("修改该学生的学生的线性代数成绩为:",i+1);
scanf("%d",&p->scores[1]);
go();
printf("修改该学生的学生的大学英语成绩为:",i+1);
scanf("%d",&p->scores[2]);
}
}
void save_stu()
{
pStu p=Stu_Head->next;
FILE *fp;
fp=fopen("student.txt","w");
if(fp==NULL){
printf("\t文件打开失败!\n");
exit(-1);
}
while(p!=NULL)
{
fprintf(fp,"%-5s %-10s %-5s %-15s %2d %2d %2d %2d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],
p->scores[0]+p->scores[1]+p->scores[2]);
p=p->next;
}
fclose(fp);
go();
printf("文件保存成功!\n");
}
void find_by_sno()
{
int flag=0,i=0;
char sno[50];
pStu p=Stu_Head->next;
go();
printf("请输入要查找的学生的学号:");
scanf("%s",sno);
while(p!=NULL)
{
if(!strcmp(sno,p->sno)){
flag=1;break;
}
if(i>len_stu())break;
i++;
p=p->next;
}
if(flag){
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
p=p->next;
}
else{
go();
printf("未能查询到该学生,请检查输入是否有误!\n");
}
}
void find_by_name()
{
int flag=0,i=0;
char name[50];
pStu p=Stu_Head->next;
go();
printf("请输入要查找的学生的姓名:");
scanf("%s",name);
while(p!=NULL)
{
if(!strcmp(name,p->name)){
flag=1;break;
}
if(i>len_stu())break;
i++;
p=p->next;
}
if(flag){
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
p=p->next;
}
else{
go();
printf("未能查询到该学生,请检查输入是否有误!\n");
}
}
void find_by_sex()
{
int flag=0,i=0;
char sex[5];
pStu p=Stu_Head->next;
go();
printf("请输入要查找的学生的性别:");
scanf("%s",sex);
while(p!=NULL)
{
if(!strcmp(sex,p->sex)){
flag++;
if(flag==1)
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
}
if(i>len_stu())break;
i++;
p=p->next;
}
if(flag==0){
go();
printf("未能查询到该学生,请检查输入是否有误!\n");
}
}
void find_by_native()
{
int flag=0,i=0;
char native[30];
pStu p=Stu_Head->next;
go();
printf("请输入要查找的学生的籍贯:");
scanf("%s",native);
while(p!=NULL)
{
if(!strcmp(native,p->native)){
flag++;
if(flag==1)
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
}
if(i>len_stu())break;
i++;
p=p->next;
}
if(flag==0){
go();
printf("未能查询到该学生,请检查输入是否有误!\n");
}
}
void sort_by_sno()
{
int n=len_stu();
int i,j;
char sno[n][30];
char t_sno[30];
pStu p=Stu_Head->next;
for(i=0;i<n&&p!=NULL;i++,p=p->next)
strcpy(sno[i],p->sno);
for(i=1;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(atoi(sno[j+1])<atoi(sno[j])){
strcpy(t_sno,sno[j+1]);
strcpy(sno[j+1],sno[j]);
strcpy(sno[j],t_sno);
}
}
}
printf("\n");
p=Stu_Head->next;
printf("\t******************************************************按学号升序排序如下********************************************************************\n");
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
while(p!=NULL){
p->flag=0;p=p->next;
}
for(i=0;i<n;i++)
{
p=Stu_Head->next;
while(p!=NULL)
{
if(!strcmp(p->sno,sno[i])&&p->flag==0){
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
p->flag=1;
break;
}
p=p->next;
}
}
}
void sort_by_name()
{
int n=len_stu();
int i,j;
char name[n][30];
char t_name[30];
pStu p=Stu_Head->next;
for(i=0;i<n&&p!=NULL;i++,p=p->next)
strcpy(name[i],p->name);
for(i=1;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(strcmp(name[j+1],name[j])<0){
strcpy(t_name,name[j+1]);
strcpy(name[j+1],name[j]);
strcpy(name[j],t_name);
}
}
}
p=Stu_Head->next;
printf("\t******************************************************按姓名升序排序如下********************************************************************\n");
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
while(p!=NULL){
p->flag=0;p=p->next;
}
for(i=0;i<n;i++)
{
p=Stu_Head->next;
while(p!=NULL)
{
if(!strcmp(p->name,name[i])&&p->flag==0){
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
p->flag=1;
break;
}
p=p->next;
}
}
}
void sort_by_scores()
{
int n=len_stu();
int i,j;
int sum[n];
int temp;
pStu p=Stu_Head->next;
for(i=0;i<n&&p!=NULL;i++,p=p->next)
sum[i]=p->sum_scores;
for(i=1;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(sum[j+1]<sum[j]){temp=sum[j+1];sum[j+1]=sum[j];sum[j]=temp;}
}
}
p=Stu_Head->next;
printf("\t******************************************************按总成绩升序排序如下********************************************************************\n");
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
while(p!=NULL){
p->flag=0;p=p->next;
}
for(i=0;i<n;i++)
{
p=Stu_Head->next;
while(p!=NULL)
{
if(p->sum_scores==sum[i]&&p->flag==0){
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
p->flag=1;
break;
}
p=p->next;
}
}
}
void screen_by_good()
{
int flag=0,i=0;
pStu p=Stu_Head->next;
while(p!=NULL)
{
if(p->sum_scores/3>=80){
flag++;
if(flag==1){
printf("\t******************************************************平均成绩优秀的学生如下********************************************************************\n");
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
}
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
}
if(i>len_stu())break;
i++;
p=p->next;
}
if(flag==0){
go();
printf("未找到平均成绩优秀的学生!\n");
}
}
void screen_by_fail()
{
int flag=0,i=0;
pStu p=Stu_Head->next;
while(p!=NULL)
{
if(p->scores[0]<60||p->scores[1]<60||p->scores[2]<60){
flag++;
if(flag==1){
printf("\t******************************************************存在单科不及格的学生如下********************************************************************\n");
printf("\t\t学号\t\t姓名\t\t性别\t\t籍贯\t\t高等数学\t线性代数\t大学英语\t总成绩\n");
}
printf("\t\t%-5s\t\t%-5s\t\t%-5s\t\t%-15s\t% -02d\t\t% -02d\t\t %-02d\t\t %-02d\n",
p->sno,p->name,p->sex,p->native,p->scores[0],p->scores[1],p->scores[2],p->sum_scores);
}
if(i>len_stu())break;
i++;
p=p->next;
}
if(flag==0){
go();
printf("未找到存在单科不及格的学生!\n");
}
}
void top_menu_1()
{
int i=0;
for(i=0;i<16;i++)
{
if(i==13)
printf("%*s",36,"");
else
go();
printf("%s\n",UI_1[i]);
}
}
void top_menu_2()
{
int i=0;
for(i=0;i<10;i++)
{
if(i==5)
printf("%*s",36,"");
else
go();
printf("%s\n",UI_2[i]);
}
}
void top_menu_3()
{
int i=0;
for(i=0;i<10;i++)
{
if(i==6)
printf("%*s",36,"");
else
go();
printf("%s\n",UI_3[i]);
}
}
void top_menu_4()
{
int i=0;
for(i=0;i<10;i++)
{
if(i==4)
printf("%*s",36,"");
else
go();
printf("%s\n",UI_4[i]);
}
}
void choice_menu()
{
int x=1;
int choice;
while(x)
{
system("cls");
top_menu_1();
go();
printf("请输入您要选择的操作对应的序号:");
scanf("%d",&choice);
switch(choice)
{
case 1:
creat_stu();
go();
printf("录入成功!\n");
go();
system("pause");
break;
case 2:
add_stu();
go();
printf("添加成功!\n");
go();
system("pause");
break;
case 3:
del_stu();
go();
printf("删除成功!\n");
go();
system("pause");
break;
case 4:
mod_stu();
go();
printf("修改成功!\n");
go();
system("pause");
break;
case 5:
choice_submenu_1();
break;
case 6:
choice_submenu_2();
break;
case 7:
choice_submenu_3();
break;
case 8:
save_stu();
go();
printf("保存成功!\n");
go();
system("pause");
break;
case 9:
show_stu();
go();
system("pause");
break;
case 10:
restore_system();
go();
printf("系统还原成功!\n");
go();
system("pause");
break;
case 0:
x=0;
break;
}
}
}
void choice_submenu_1()
{
int x=1;
int choice;
while(x)
{
system("cls");
top_menu_2();
go();
printf("请输入您要选择的操作对应的序号:");
scanf("%d",&choice);
switch(choice)
{
case 1:
sort_by_sno();
go();
system("pause");
break;
case 2:
sort_by_name();
go();
system("pause");
break;
case 3:
sort_by_scores();
go();
system("pause");
break;
case 0:
x=0;
break;
}
}
}
void choice_submenu_2()
{
int x=1;
int choice;
while(x)
{
system("cls");
top_menu_3();
go();
printf("请输入您要选择的操作对应的序号:");
scanf("%d",&choice);
switch(choice)
{
case 1:
find_by_sno();
go();
system("pause");
break;
case 2:
find_by_name();
go();
system("pause");
break;
case 3:
find_by_sex();
go();
system("pause");
break;
case 4:
find_by_native();
go();
system("pause");
break;
case 0:
x=0;
break;
}
}
}
void choice_submenu_3()
{
int x=1;
int choice;
while(x)
{
system("cls");
top_menu_4();
go();
printf("请输入您要选择的操作对应的序号:");
scanf("%d",&choice);
switch(choice)
{
case 1:
screen_by_good();
go();
system("pause");
break;
case 2:
screen_by_fail();
go();
system("pause");
break;
case 0:
x=0;
break;
}
}
}
void load_cartoon()
{
int i,l,j;
for(i=0;i<5;i++)
{
gotoxy(59,20+i);
printf("%s\n",cartoon[i]);
}
for (l = 0; l < 3; l++)
{
for (i = 53; i <= 71; i = i + 2)
{
for (j = i - 4; j <= i; j = j + 2)
{
if (j >= 53 && j <= 70)
{
gotoxy(j+25, 22);
printf("[]");
}
Sleep(75);
}
for (j = i - 4; j <= i; j = j + 2)
{
if (j >= 53 && j <= 70)
{
gotoxy(j+25, 22);
printf(" ");
}
}
}
}
}
int main()
{
system("mode con cols=200 lines=100");
system("color 70");
srand((unsigned)time(NULL));
regis();
login();
restore_system();
if(flag){
system("cls");
load_cartoon();
creat_stu();
choice_menu();
}
save_stu();
return 0;
}
|