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.

212 lines
4.8 KiB

6 years ago
#include<stdio.h>
#include<string.h>
#include<conio.h>
#define N 80
typedef struct
{
char num[N];
char name[20];
char tele[15];
char add[20];
char emal[15];
}STUDENT;
STUDENT stu[N] ;
int menu();
int shuru(STUDENT stu[N]);
void xianshi(STUDENT stu[],int n);
int shanchu(STUDENT stu[],int n);
void chazhao(STUDENT stu[],int n);
void xiugai(STUDENT stu[],int n);
int tianjia(STUDENT stu[],int n);
int tuichu();
int main()
{
int length,m=0;
while(m>=0)
{
switch (menu())
{
case 0:length=shuru(stu);break;
case 1: xianshi(stu,length);break;
case 2:length=shanchu(stu,length);break;
case 3:chazhao(stu,length);break;
case 4:xiugai(stu,length);break;
case 5:length=tianjia(stu,length);break;
case 6:m=tuichu();break;
default:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
}
}
}
int menu()
{
int m;
printf(" <20><>ӭʹ<D3AD><CAB9>ͨѶ¼<D1B6><C2BC><EFBFBD><EFBFBD>ϵͳ \n");
printf(" <20><><EFBFBD>˵<EFBFBD> \n");
printf("\t\t\t 0.<2E><><EFBFBD><EFBFBD>ͨѶ¼\n");
printf("\t\t\t 1.<2E><>ʾͨѶ¼\n");
printf("\t\t\t 2.ɾ<><C9BE>ͨѶ¼\n");
printf("\t\t\t 3.<2E><><EFBFBD><EFBFBD>ͨѶ¼\n");
printf("\t\t\t 4.<2E>޸<EFBFBD>ͨѶ¼\n");
printf("\t\t\t 5.<2E><><EFBFBD><EFBFBD>ͨѶ¼\n");
printf("\t\t\t 6.<2E>˳<EFBFBD>ͨѶ¼\n");
do{
printf("\t\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>0-6\n");
scanf("%d",&m);
}while(m<0||m>6);
return m;
}
int shuru(STUDENT stu[N])
{
int i,n;
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ \n");
scanf("%d",&n);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ \n");
for(i=0;i<n;i++)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>\n");
scanf("%s",stu[i].num);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%s",stu[i].name);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>绰:\n");
scanf("%s",stu[i].tele);
printf(" \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>\n");
scanf("%s",stu[i].add);
printf(" \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>emal:\n");
scanf("%s",stu[i].emal);
printf("<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>%s\nemal:%s\n",stu[i].num,stu[i].name,stu[i].tele,stu[i].add,stu[i].emal);
}
return n;
}
void xianshi(STUDENT stu[],int n)
{
int i;
for(i=0;i<=n-1;i++)
{
printf("<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>%s\nemal:%s\n",stu[i].num,stu[i].name,stu[i].tele,stu[i].add,stu[i].emal);
}
}
int find(STUDENT stu[],int n)
{
int i;
char s[20];
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%s",s);
for(i=0;i<n;i++)
if(strcmp(s,stu[i].name)==0)
return i;
}
int shanchu(STUDENT stu[],int n)
{
int i,j,ch;
i=find(stu,n);
if(i>n-1)
{
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>¼,<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1/0(1<><31><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)\n");
scanf("%d",&ch);
if(ch==1)
n=shanchu(stu,n);
}
else
{
printf("<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>%s\nemal:%s\n",stu[i].num,stu[i].name,stu[i].tele,stu[i].add,stu[i].emal);
printf("<EFBFBD>Ƿ<EFBFBD>ȷ<EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD>:%d<><64>%2d<32><64>\n",1,0);
}
scanf("%d",&ch);
if(ch==1)
{
for(j=i+1;j<N;j++)
{
strcpy(stu[j-1].name,stu[j].name);
strcpy(stu[j-1].tele,stu[j].tele);
strcpy(stu[j-1]. add,stu[j]. add);
strcpy(stu[j-1].emal,stu[j].emal);
}
n--;
printf(" ɾ<><C9BE><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>\n");
}
return n;
}
void chazhao(STUDENT stu[],int n)
{
int i,ch;
i=find(stu,n);
if(i>n-1)
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵļ<EFBFBD>¼,<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1/0\n");
scanf("%d",&ch);
if(ch==1)
chazhao(stu,n);
else
printf("<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>%s\nemal:%s\n",stu[i].num,stu[i].name,stu[i].tele,stu[i].add,stu[i].emal);
}
void xiugai(STUDENT stu[],int n)
{
int i,ch;
i=find(stu,n);
if(i>n-1)
{
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>Ҫ<EFBFBD>޸ĵļ<EFBFBD>¼,<2C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1/0\n");
scanf("%d",&ch);
if(ch==1)
xiugai(stu,n);
}
else
{
printf("<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD><EFBFBD>%s\n<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>%s\nemal:%s\n",stu[i].num,stu[i].name,stu[i].tele,stu[i].add,stu[i].emal);
printf("<EFBFBD>Ƿ<EFBFBD>ȷ<EFBFBD><EFBFBD>Ҫ<EFBFBD>޸<EFBFBD>:%d<><64>%2d<32><64>\n",1,0);
}
scanf("%d",&ch);
if(ch==1)
{
printf("<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>\n");
scanf("%s",stu[i].num);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD>");
scanf("%s",stu[i].name);
printf(" \n<EFBFBD>绰:\n");
scanf("%s",stu[i].tele);
printf(" \n<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>\n");
scanf("%s",stu[i].add);
printf(" \nnemal:\n");
scanf("%s",stu[i].emal);
printf(" <20>޸ijɹ<C4B3><C9B9><EFBFBD>\n");
}
}
int tianjia(STUDENT stu[],int n)
{
int i,j;
if(N<=n+1)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
else
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>\n");
scanf("%d",&i);
for(j=n-1;j>=i;j--)
{
strcpy(stu[j+1].name,stu[j].name);
strcpy(stu[j+1].tele,stu[j].tele);
strcpy(stu[j+1].add,stu[j].add);
strcpy(stu[j+1].emal,stu[j].emal);
}
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>\n");
scanf("%s",stu[i].num);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%s",stu[i].name);
printf(" \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>绰:\n");
scanf("%s",stu[i].tele);
printf(" \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>\n");
scanf("%s",stu[i].add);
printf(" \n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>emal:\n");
scanf("%s",stu[i].emal);
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD>\n");
n++;
}
return n;
}
int tuichu()
{
int n;
n=-1;
printf(" ллʹ<D0BB><CAB9> ");
return n;
}