diff --git a/程序设计.cpp b/程序设计.cpp new file mode 100644 index 0000000..3ff15c0 --- /dev/null +++ b/程序设计.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#define LEN 20 /* ѧźַ */ +#define N 1000 /* ѧ*/ +struct record /*ṹ*/ +{ +char id[LEN+1]; /* ѧ */ +char name[LEN+1]; /* */ +int age; /* */ +char sex[3]; /* Ա */ +char birth[LEN+1]; /* */ +char add[30]; /* ַͥ */ +char tel[LEN+1]; /* 绰 */ +char email[30]; /* ʼַ */ +}stu[N]; +int n,m; /* ȫֱ nΪǰѧ mʾÿӵѧ */ +void refresh();/* Ϣ */ +void seek();/* Ϣ */ +void modify();/* ޸Ϣ */ +void add();/* Ϣ */ +void dele();/* ɾϢ */ +void show();/* ʾϢ */ +void save();/* Ϣ */ +int main() +{ +while(1) +void sort()/*ѧ*/ +{ +int i,j,*p,*q,s; +char temp[10]; +for(i=0;ii;j--) +if(strcmp(stu[j-1].code,stu[j].code)>0) +{ +strcpy(temp,stu[j-1].code); +strcpy(stu[j-1].code,stu[j].code); +strcpy(stu[j].code,temp); +strcpy(temp,stu[j-1].name); +strcpy(stu[j-1].name,stu[j].name); +strcpy(stu[j].name,temp); +strcpy(temp,stu[j-1].sex); +strcpy(stu[j-1].sex,stu[j].sex); +strcpy(stu[j].sex,temp); +strcpy(temp,stu[j-1].time); +strcpy(stu[j-1].time,stu[j].time); +strcpy(stu[j].time,temp); +strcpy(temp,stu[j-1].add); +strcpy(stu[j-1].add,stu[j].add); +strcpy(stu[j].add,temp); +strcpy(temp,stu[j-1].tel); +strcpy(stu[j-1].tel,stu[j].tel); +strcpy(stu[j].tel,temp); +strcpy(temp,stu[j-1].mail); +strcpy(stu[j-1].mail,stu[j].mail); +strcpy(stu[j].mail,temp); +p=&stu[j-1].age; +q=&stu[j].age; +s=*q; +*q=*p; +*p=s; +} +} +} +void add() /*뺯ѧ*/ +{ +int i=n,j,flag; +printf("ӵѧ:\n"); +scanf("%d",&m); +do +{ +flag=1; +while(flag) +{ +flag=0; +printf(" %d ѧѧ:\n",i+1); +scanf("%s",stu[i].code); +for(j=0;j