|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <conio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
int n=0,i;
|
|
|
|
|
struct address_book
|
|
|
|
|
{
|
|
|
|
|
char name[20];
|
|
|
|
|
int num;
|
|
|
|
|
int age;
|
|
|
|
|
char place[80];
|
|
|
|
|
char sex;
|
|
|
|
|
char clas[40];
|
|
|
|
|
char department[40];
|
|
|
|
|
char domain[40];
|
|
|
|
|
char dowhat[20];
|
|
|
|
|
}stud[200];
|
|
|
|
|
void add()
|
|
|
|
|
{
|
|
|
|
|
char j;
|
|
|
|
|
front1:
|
|
|
|
|
system("cls");//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[n].name);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>8λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&stud[n].num);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>F/M<><4D><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("\n%c",&stud[n].sex);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣺");
|
|
|
|
|
scanf("%d",&stud[n].age);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵİ༶<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[n].clas);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵļ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[n].place);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[n].department);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>רҵ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[n].domain);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[n].dowhat);
|
|
|
|
|
getchar();
|
|
|
|
|
n++;
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y/N<><4E>?<3F><>");
|
|
|
|
|
j=getchar();
|
|
|
|
|
getchar();
|
|
|
|
|
if(j=='y'||j=='Y') goto front1;//<2F>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|
|
|
|
}
|
|
|
|
|
void del()
|
|
|
|
|
{
|
|
|
|
|
int k=0,m,i;
|
|
|
|
|
char j;
|
|
|
|
|
front2:
|
|
|
|
|
system("cls");//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&m);
|
|
|
|
|
getchar();
|
|
|
|
|
for(i=0;i<n;i++)//<2F><><EFBFBD>Ҽ<EFBFBD>¼
|
|
|
|
|
if(m==stud[i].num)
|
|
|
|
|
{
|
|
|
|
|
k=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(k==1)//ɾ<><C9BE><EFBFBD><EFBFBD>¼
|
|
|
|
|
{
|
|
|
|
|
for(k=i;k<n-1;k++)
|
|
|
|
|
stud[k]=stud[k+1];
|
|
|
|
|
n--;
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>\n\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>¼<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>");
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y/N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
j=getchar();
|
|
|
|
|
getchar();
|
|
|
|
|
if(j=='y'||j=='Y') goto front2;
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
void arrange()
|
|
|
|
|
{
|
|
|
|
|
int k,i;
|
|
|
|
|
struct address_book t;
|
|
|
|
|
system("cls");//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD> רҵ <20><><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(k=0;k<n-1;k++)
|
|
|
|
|
for(i=0;i<n-k-1;i++)
|
|
|
|
|
if(stud[i].num>stud[i+1].num)
|
|
|
|
|
{
|
|
|
|
|
t=stud[i];
|
|
|
|
|
stud[i]=stud[i+1];
|
|
|
|
|
stud[i+1]=t;
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<=n-1;i++)
|
|
|
|
|
if(stud[i].num!=0)
|
|
|
|
|
printf("%-8d %-10s %-10s\n",stud[i].num,stud[i].domain,stud[i].place);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>");
|
|
|
|
|
getchar();
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
void change()
|
|
|
|
|
{
|
|
|
|
|
int k=0,m;
|
|
|
|
|
char j;
|
|
|
|
|
front5:
|
|
|
|
|
system("cls");//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ļ<EFBFBD>¼<EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&m);
|
|
|
|
|
getchar();
|
|
|
|
|
for(i=0;i<n;i++)//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
if(m==stud[i].num)
|
|
|
|
|
{
|
|
|
|
|
k=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(k==1)
|
|
|
|
|
{
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[i].name);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>8λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&stud[i].num);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>F/M<><4D><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%c",&stud[i].sex);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣺");
|
|
|
|
|
scanf("%d",&stud[i].age);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵİ༶<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[i].clas);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵļ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[i].place);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[i].department);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>רҵ<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[i].domain);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",stud[n].dowhat);
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
if(k==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵļ<EFBFBD>¼<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>");
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
getchar();
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y/N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
j=getchar();
|
|
|
|
|
getchar();
|
|
|
|
|
if(j=='y'||j=='Y') goto front5;
|
|
|
|
|
}
|
|
|
|
|
void find()
|
|
|
|
|
{
|
|
|
|
|
int k=0,m;
|
|
|
|
|
char j;
|
|
|
|
|
front3:
|
|
|
|
|
system("cls");//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&m);
|
|
|
|
|
getchar();
|
|
|
|
|
for(i=0;i<n;i++)//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
if(m==stud[i].num)
|
|
|
|
|
{
|
|
|
|
|
k=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(k==1)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD> רҵ <20><><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("%-8d %-10s %-10s\n",stud[i].num,stud[i].domain,stud[i].place);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
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>");
|
|
|
|
|
getchar();
|
|
|
|
|
goto front3;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y/N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
j=getchar();
|
|
|
|
|
getchar();
|
|
|
|
|
if(j=='y'||j=='Y') goto front3;
|
|
|
|
|
}
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
char j;
|
|
|
|
|
printf("\n\n\n\n\n\n\t\t\t <20><>ӭʹ<D3AD><CAB9>ѧ<EFBFBD><D1A7>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ");
|
|
|
|
|
printf("\n\n\n\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>羲");
|
|
|
|
|
printf("\n\n\n\t\t\t\t 2019<31><39>1<EFBFBD><31>");
|
|
|
|
|
printf("\n\n\n\n\n\n\n\n\n\n\n\n<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
getchar();
|
|
|
|
|
loop:
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("\t\t\t\t ************\n");
|
|
|
|
|
printf("\t\t\t\t ***<2A><><EFBFBD>˵<EFBFBD>***\n");
|
|
|
|
|
printf("\t\t\t\t ************\n\n\n\n\n\n");
|
|
|
|
|
printf("\t\t 1<><31>¼<EFBFBD><C2BC>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ2<CFA2><32>ɾ<EFBFBD><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n\n");
|
|
|
|
|
printf("\t\t 3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ4<CFA2><34>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>\n\n");
|
|
|
|
|
printf("\t\t 5<><35><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ6<CFA2><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>ϵͳ\n\n");
|
|
|
|
|
printf("\n\n\n\n\n\n\n\n\n<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>[1/2/3/4/5/6]:");
|
|
|
|
|
j=getchar();
|
|
|
|
|
if(j=='\n') goto loop;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
switch(j)
|
|
|
|
|
{
|
|
|
|
|
case '1': add();goto loop;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
case '2': del();goto loop;
|
|
|
|
|
case '3': find();goto loop;
|
|
|
|
|
case '4': arrange();goto loop;
|
|
|
|
|
case '5': change();goto loop;
|
|
|
|
|
case '6':
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("student.dat","w");
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
fwrite(&stud[i],sizeof(struct address_book),1,fp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
default: goto loop;
|
|
|
|
|
}
|
|
|
|
|
}
|