You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

305 lines
6.7 KiB

6 years ago
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void menu();//<2F><><EFBFBD><EFBFBD>ϵͳ<CFB5>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><E6BAAF>
void teacher_login();//<2F><>ʦ<EFBFBD><CAA6>½<EFBFBD><C2BD><EFBFBD><EFBFBD><E6BAAF>
void student_login();//ѧ<><D1A7><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><E6BAAF>
void login();//<2F><>½ѧ<C2BD><D1A7>ѡ<EFBFBD><D1A1>ϵͳ<CFB5>ܽ<EFBFBD><DCBD><EFBFBD>
void out();//<2F>˳<EFBFBD>ϵͳ
void search();//<2F>γ̲<CEB3>ѯ
void look();//<2F>γ<EFBFBD><CEB3><EFBFBD><EFBFBD><EFBFBD>
void select();//<2F>γ<EFBFBD><CEB3><EFBFBD>ѡ
void put_course();//<2F><><EFBFBD><EFBFBD>ʦ<EFBFBD><CAA6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ̵<CEB3><CCB5><EFBFBD>Ϣ
struct course
{
int course_num;//<2F>γ̱<CEB3><CCB1><EFBFBD>
char course_name[10];//<2F>γ<EFBFBD><CEB3><EFBFBD><EFBFBD><EFBFBD>
char course_sore[10];//<2F><><EFBFBD><EFBFBD><EFBFBD>ڿλ<DABF><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD>
int course_score;//<2F>γ<EFBFBD>ѧ<EFBFBD><D1A7>
int course_classtime;//<2F>ڿ<EFBFBD>ѧʱ
int course_programtime;//ʵ<><CAB5>ѧʱ
int course_count;//<2F>γ<EFBFBD><CEB3>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD>
};
void out()
{
exit(0);
}//<2F>˳<EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>
void menu()//ѧ<><D1A7>ѡ<EFBFBD><D1A1>ϵͳ<CFB5>ܽ<EFBFBD><DCBD><EFBFBD>
{
printf("********************************\n");
printf("<EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD>ҵ<EFBFBD><EFBFBD>ѧѧ<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>ϵͳ\n");
printf("********************************\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
}
void login()//<2F><>½<EFBFBD><C2BD><EFBFBD><EFBFBD>
{
6 years ago
system("CLS");
6 years ago
void teacher_login();
void student_login();
int q;
do
{
printf("ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD>밴:1\n");
printf("<EFBFBD><EFBFBD>ʦ<EFBFBD><EFBFBD>½<EFBFBD>밴:2\n");
printf("<EFBFBD>˳<EFBFBD>ϵͳ<EFBFBD>밴:3\n");
scanf("%d",&q);
if(q!=1&&q!=2&&q!=3)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
getchar();
}
if(q==3)
out();//<2F>˳<EFBFBD>ϵͳ
switch(q)
{
case 1:student_login();break;
case 2:teacher_login();break;
}
}while(q!=1&&q!=2&&q!=3);
}
void teacher_login()//<2F><>ʦ
{
6 years ago
system("CLS");
6 years ago
void search();
void look();
int e;
do
{
printf("<EFBFBD>γ̲<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>1\n");
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2\n");
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>룺3\n");
printf("<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>4\n");
scanf("%d",&e);
if(e!=1&&e!=2&&e!=3&&e!=4)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
}
else if(e==4)
out ();
else if(e==1||e==2)
{
switch(e)
{
case 1:search();break;
case 2:look();break;
}
}
else if(e==3)
put_course();
}while(e!=1&&e!=2&&e!=3&&e!=4);
}
void student_login()//ѧ<><D1A7>
{
6 years ago
system("CLS");
6 years ago
void out();
void search();
void look();
void select();
int w;
do
{
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>1\n");
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2\n");
printf("<EFBFBD>γ̲<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>3\n");
printf("<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>4\n");
scanf("%d",&w);
if(w!=1&&w!=2&&w!=3&&w!=4)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
getchar();
}
if(w==4)
exit(0);
switch(w)
{
case 1:select();break;
case 2:look();break;
case 3:search();break;
case 4:out();break;
}
}while(w!=1&&w!=2&&w!=3&&w!=4);
}
void select()//ѧ<><D1A7>ѡ<EFBFBD>κ<EFBFBD><CEBA><EFBFBD>
{
6 years ago
system("CLS");
6 years ago
FILE *fp1;//<2F><><EFBFBD><EFBFBD><EFBFBD>γ̵<CEB3><CCB5>ļ<EFBFBD>
int i=0,temp=0,n,j,r,t,y;
struct course courses[5];
if((fp1=fopen("course.txt","rb"))==NULL)//<2F>Ѵ<D1B4>γ̵<CEB3><CCB5>ļ<EFBFBD><C4BC>׵<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ָ<EFBFBD><D6B8>fp1
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD>򿪴<EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
getchar();
student_login();
}
do
{
fread(&courses[i],sizeof(struct course),1,fp1);//<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD><EFBFBD><E1B9B9><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
i+=1;
}while(!feof(fp1));
fclose(fp1);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>Ŀγ̱<EFBFBD><EFBFBD><EFBFBD>:<3A><>1,2,3,4,5\n");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1,2,3,4,5<><35>
scanf("%d",&n);
for(j=0;j<5;j++)
if(n==courses[j].course_num)
{
temp+=1;
t=j;
break;
}
if(temp==0)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ̺Ŷ<EFBFBD>Ӧ<EFBFBD>Ŀγ<EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>밴1 <20><><EFBFBD><EFBFBD><EFBFBD>밴2 \n");
scanf("%d",&r);
switch(r)
{
case 1:select();break;
case 2:student_login();break;
default:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣬽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");exit(0);
}
}
else
{
courses[t].course_count+=1;//<2F><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7>ѡ<EFBFBD>ε<EFBFBD><CEB5><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
printf("ѡ<EFBFBD>γɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>֪ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>μӿγ̣<EFBFBD>\n");
getchar();
getchar();
}
fp1=fopen("course.txt","wb");
for(y=0;y<5;y++)
{
fwrite(&courses[y],sizeof(struct course),1,fp1);//<2F><>ѧ<EFBFBD><D1A7>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
}
fclose(fp1);
}
void look()//<2F>γ<EFBFBD><CEB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ̵<CEB3><CCB5><EFBFBD>Ϣ
{
6 years ago
system("CLS");
6 years ago
struct course courses[5];
FILE *fp2;
int i=0,j;
if((fp2=fopen("course.txt","rb"))==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD>򿪴<EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
exit(0);
}
do
{
fread(&courses[i],sizeof(struct course),1,fp2);
i+=1;
}while(!feof(fp2));
for(j=0;j<5;j++)
{
printf("<EFBFBD>γ̱<EFBFBD><EFBFBD>ţ<EFBFBD>%d\n",courses[j].course_num);
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD>%s\n",courses[j].course_name);
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>%s\n",courses[j].course_sore);
printf("<EFBFBD>γ<EFBFBD>ѧ<EFBFBD>֣<EFBFBD>%d\n",courses[j].course_score);
printf("<EFBFBD>ڿ<EFBFBD>ѧʱ<EFBFBD><EFBFBD>%d\n",courses[j].course_classtime);
printf("ʵ<EFBFBD><EFBFBD>ѧʱ<EFBFBD><EFBFBD>%d\n",courses[j].course_programtime);
printf("<EFBFBD>γ<EFBFBD><EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d\n\n",courses[j].course_count);
}
fclose(fp2);
getchar();
getchar();
}
void search()//<2F>γ̲<CEB3>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
{
6 years ago
system("CLS");
6 years ago
FILE *fp3;
int num;
struct course courses[5];
int i=0,j;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD>Ŀγ̵ı<EFBFBD><EFBFBD><EFBFBD>:<3A><>1,2,3,4,5\n");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1,2,3,4,5<><35>
scanf("%d",&num);
6 years ago
system("CLS");
6 years ago
if(num!=1&&num!=2&&num!=3&&num!=4&&num!=5)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣡰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
getchar();
search();
}
if((fp3=fopen("course.txt","rb"))==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD>򿪴<EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
exit(0);
}
do
{
fread(&courses[i],sizeof(struct course),1,fp3);
i+=1;
}while(!feof(fp3));
fclose(fp3);
for(j=0;j<5;j++)
if(courses[j].course_num==num)
{
printf("<EFBFBD>γ̱<EFBFBD><EFBFBD>ţ<EFBFBD>%d\n",courses[j].course_num);
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD>%s\n",courses[j].course_name);
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>%s\n",courses[j].course_sore);
printf("<EFBFBD>γ<EFBFBD>ѧ<EFBFBD>֣<EFBFBD>%d\n",courses[j].course_score);
printf("<EFBFBD>ڿ<EFBFBD>ѧʱ<EFBFBD><EFBFBD>%d\n",courses[j].course_classtime);
printf("ʵ<EFBFBD><EFBFBD>ѧʱ<EFBFBD><EFBFBD>%d\n",courses[j].course_programtime);
printf("<EFBFBD>γ<EFBFBD><EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d\n",courses[j].course_count);
break;
}
getchar();
getchar();
}
void put_course()
{
6 years ago
system("CLS");
6 years ago
FILE *fp;
struct course courses[5];
printf("<EFBFBD><EFBFBD>ʦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf("1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD> 5 30 3 0\n");
printf("2 Ӣ<><D3A2> <20><><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD> 5 30 5 0\n");
printf("3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD> 5 30 5 0\n");
printf("4 <20><><EFBFBD><EFBFBD>ѧ <20><><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD> 5 30 5 0\n");
printf("5 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD> 5 30 5 0\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬ע<EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>ÿո<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ѧ<EFBFBD>֣<EFBFBD><EFBFBD>ڿ<EFBFBD>ѧʱ<EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD>ѧʱ<EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD>ʦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱΪ<EFBFBD><EFBFBD>ʡʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>԰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
int j;
for(j=0;j<5;j++)
{
scanf("%d%s%s%d%d%d%d",&courses[j].course_num,courses[j].course_name,courses[j].course_sore,&courses[j].course_score,&courses[j].course_classtime,&courses[j].course_programtime,&courses[j].course_count);
}
int i;
if((fp=fopen("course.txt","wb"))==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD>򿪴<EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
getchar();
exit(0);
}
for(i=0;i<5;i++)
{
fwrite(&courses[i],sizeof(struct course),1,fp);
}
fclose(fp);
printf("<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>\n");
getchar();
getchar();
}
int main()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
menu();
printf("<EFBFBD><EFBFBD>ʦ<EFBFBD>״ε<EFBFBD>½ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦѡ<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>Ϣ,ѧ<><D1A7><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>\n");
login();
return 0;
}