|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <conio.h>
|
|
|
|
|
struct record
|
|
|
|
|
{
|
|
|
|
|
char nativeplace[20];
|
|
|
|
|
char name[20];
|
|
|
|
|
char phone1[20];
|
|
|
|
|
char phone2[20];
|
|
|
|
|
char e_mail[30];
|
|
|
|
|
}student[500];
|
|
|
|
|
int num=0;//<2F>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD>numΪ<6D>ļ<EFBFBD><C4BC>еļ<D0B5>¼<EFBFBD><C2BC>
|
|
|
|
|
FILE *fp;
|
|
|
|
|
void welcome(); //<2F><>ӭ
|
|
|
|
|
void mainmenu(); //<2F><><EFBFBD>˵<EFBFBD>
|
|
|
|
|
void newrecord(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|
|
|
|
void modify(); //<2F><EFBFBD><DEB8><EFBFBD>ϵ<EFBFBD><CFB5>
|
|
|
|
|
void modifyname(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void modifyphone1(); //<2F>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>
|
|
|
|
|
void modifyphone2(); //<2F>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>
|
|
|
|
|
void searchmenu(); //<2F><>ѯ<EFBFBD>˵<EFBFBD>
|
|
|
|
|
void searchbynativeplace(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ
|
|
|
|
|
void searchbyname(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ
|
|
|
|
|
void searchbyphone1(); //<2F><><EFBFBD>绰1<E7BBB0><31>ѯ
|
|
|
|
|
void searchbyphone2(); //<2F><><EFBFBD>绰2<E7BBB0><32>ѯ
|
|
|
|
|
void deletemenu(); //ɾ<><C9BE><EFBFBD>˵<EFBFBD>
|
|
|
|
|
void deleteall(); //ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void deleteone(); //ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void showall(); //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
void readfromfile(); //<2F><>ȡ<EFBFBD>ļ<EFBFBD>
|
|
|
|
|
void writetofile(); //д<><D0B4><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
void deletebynativeplace(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>
|
|
|
|
|
void deletebyname(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>
|
|
|
|
|
void listbynativeplace(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void listbyname(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void listmenu(); //<2F><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
int main() //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
welcome();
|
|
|
|
|
readfromfile();
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
mainmenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void showall()//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
system("cls");
|
|
|
|
|
if(num!=0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t*************** <20><><EFBFBD><EFBFBD>ΪͨѶ¼<D1B6><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ************");
|
|
|
|
|
for (i=0;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD> %s",student[i].nativeplace);
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s",student[i].name);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰1<EFBFBD><EFBFBD> %s",student[i].phone1);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰2<EFBFBD><EFBFBD> %s",student[i].phone2);
|
|
|
|
|
printf("\n\t\te-mail<69><6C>%s",student[i].e_mail);
|
|
|
|
|
printf("\t\t");
|
|
|
|
|
if (i+1<num)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t__________________________");
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n\t\t************************************************");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("\n\t\tͨѶ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κμ<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void searchmenu()//<2F><>ѯ<EFBFBD>˵<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
char choic;
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\t\t******************* <20><>ѯ<EFBFBD>˵<EFBFBD> **********************");
|
|
|
|
|
printf("\n\t\t********** 1-<2D><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD> 2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ *************");
|
|
|
|
|
printf("\n\t\t********** 3-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ 4-<2D><><EFBFBD>绰1<E7BBB0><31>ѯ ************");
|
|
|
|
|
printf("\n\t\t********** 5-<2D><><EFBFBD>绰2<E7BBB0><32>ѯ 6-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD> *************");
|
|
|
|
|
printf("\n\t\t***************************************************");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
choic=getch();
|
|
|
|
|
switch (choic)
|
|
|
|
|
{
|
|
|
|
|
case '1':showall();break;
|
|
|
|
|
case '2':searchbynativeplace();break;
|
|
|
|
|
case '3':searchbyname();break;
|
|
|
|
|
case '4':searchbyphone1();break;
|
|
|
|
|
case '5':searchbyphone2();break;
|
|
|
|
|
case '6':mainmenu();break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void searchbynativeplace()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ
|
|
|
|
|
{
|
|
|
|
|
int mark=0;
|
|
|
|
|
int i;
|
|
|
|
|
int a=0;
|
|
|
|
|
printf("\n\t\t****************** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ******************\n");
|
|
|
|
|
char nativeplace[20];
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뼮<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",nativeplace);
|
|
|
|
|
for(i=0;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(student[i].nativeplace,nativeplace)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t************** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ϣ **********");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD> %s",student[i].nativeplace);
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s",student[i].name);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰1<EFBFBD><EFBFBD> %s",student[i].phone1);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰2<EFBFBD><EFBFBD> %s",student[i].phone2);
|
|
|
|
|
printf("\n\t\te-mail<69><6C>%s",student[i].e_mail);
|
|
|
|
|
printf("\n\t\t************************************************");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
mark++;
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mark==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void searchbyname()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ
|
|
|
|
|
{
|
|
|
|
|
int mark=0;
|
|
|
|
|
int i;
|
|
|
|
|
int a=0;
|
|
|
|
|
printf("\n\t\t***************** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *******************");
|
|
|
|
|
char name[20];
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",name);
|
|
|
|
|
for(i=a;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(student[i].name,name)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t************* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ϣ ***********");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD> %s",student[i].nativeplace);
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s",student[i].name);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰1<EFBFBD><EFBFBD> %s",student[i].phone1);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰2<EFBFBD><EFBFBD> %s",student[i].phone2);
|
|
|
|
|
printf("\n\t\te-mail<69><6C>%s",student[i].e_mail);
|
|
|
|
|
printf("\n\t\t************************************************");
|
|
|
|
|
mark++;
|
|
|
|
|
if ((i+1)<num)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
{
|
|
|
|
|
a=i;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(mark!=0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˼<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˼<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void searchbyphone1()//<2F><><EFBFBD>绰1<E7BBB0><31>ѯ
|
|
|
|
|
{
|
|
|
|
|
int mark=0;
|
|
|
|
|
int i;
|
|
|
|
|
int a=0;
|
|
|
|
|
printf("\n\t\t****************** <20><><EFBFBD>绰1<E7BBB0><31><EFBFBD><EFBFBD> ******************");
|
|
|
|
|
char phone1[10];
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>绰1:");
|
|
|
|
|
scanf("%s",phone1);
|
|
|
|
|
for(i=0;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(student[i].phone1,phone1)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t************** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ϣ **********");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD> %s",student[i].nativeplace);
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s",student[i].name);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰1<EFBFBD><EFBFBD> %s",student[i].phone1);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰2<EFBFBD><EFBFBD> %s",student[i].phone2);
|
|
|
|
|
printf("\n\t\te-mail<69><6C>%s",student[i].e_mail);
|
|
|
|
|
printf("\n\t\t************************************************");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
mark++;
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mark==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void searchbyphone2() //<2F><><EFBFBD>绰2<E7BBB0><32>ѯ
|
|
|
|
|
{
|
|
|
|
|
int mark=0;
|
|
|
|
|
int i;
|
|
|
|
|
int a=0;
|
|
|
|
|
printf("\n\t\t****************** <20><><EFBFBD>绰2<E7BBB0><32><EFBFBD><EFBFBD> ******************");
|
|
|
|
|
char phone2[10];
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>绰2:");
|
|
|
|
|
scanf("%s",phone2);
|
|
|
|
|
for(i=0;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(student[i].phone2,phone2)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t************** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ϣ **********");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD> %s",student[i].nativeplace);
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s",student[i].name);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰1<EFBFBD><EFBFBD> %s",student[i].phone1);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰2<EFBFBD><EFBFBD> %s",student[i].phone2);
|
|
|
|
|
printf("\n\t\te-mail<69><6C>%s",student[i].e_mail);
|
|
|
|
|
printf("\n\t\t************************************************");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
mark++;
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mark==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void listmenu()//<2F><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
char choic;
|
|
|
|
|
if(num==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD>Բ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κμ<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\t\t******************* <20><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD> *******************");
|
|
|
|
|
printf("\n\t\t********** 1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> **********");
|
|
|
|
|
printf("\n\t\t********** 3-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD> **********");
|
|
|
|
|
printf("\n\t\t************************************************");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
choic=getch();
|
|
|
|
|
switch(choic)
|
|
|
|
|
{
|
|
|
|
|
case '1':listbynativeplace();break;
|
|
|
|
|
case '2':listbyname();break;
|
|
|
|
|
case '3':mainmenu();break;
|
|
|
|
|
default:mainmenu();break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void listbynativeplace()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i,j;
|
|
|
|
|
struct record tmp;
|
|
|
|
|
for (i=1;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(student[i].nativeplace,student[i-1].nativeplace)<0)
|
|
|
|
|
{
|
|
|
|
|
tmp=student[i];
|
|
|
|
|
j=i-1;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
student[j+1]=student[j];
|
|
|
|
|
j--;
|
|
|
|
|
}while ((strcmp(tmp.nativeplace,student[j].nativeplace)<0)&&j>=0);
|
|
|
|
|
student[j+1]=tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>,<2C>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
showall();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void listbyname()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i,j;
|
|
|
|
|
struct record tmp;
|
|
|
|
|
for (i=1;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(student[i].name,student[i-1].name)<0)
|
|
|
|
|
{
|
|
|
|
|
tmp=student[i];
|
|
|
|
|
j=i-1;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
student[j+1]=student[j];
|
|
|
|
|
j--;
|
|
|
|
|
}while ((strcmp(tmp.name,student[j].name)<0&&j>=0));
|
|
|
|
|
student[j+1]=tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>,<2C>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
showall();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void deletemenu()//ɾ<><C9BE><EFBFBD>˵<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
char choic;
|
|
|
|
|
if(num==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD>Բ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κμ<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\t\t******************* ɾ<><C9BE><EFBFBD>˵<EFBFBD> *******************");
|
|
|
|
|
printf("\n\t\t*********** 1-ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2-ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ***********");
|
|
|
|
|
printf("\n\t\t*********** 3-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD> ***********");
|
|
|
|
|
printf("\n\t\t************************************************");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
choic=getch();
|
|
|
|
|
switch (choic)
|
|
|
|
|
{
|
|
|
|
|
case '1':deleteall();break;
|
|
|
|
|
case '2':deleteone();break;
|
|
|
|
|
case '3':mainmenu();break;
|
|
|
|
|
default:mainmenu();break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void deleteall()//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tȷ<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
{
|
|
|
|
|
fclose(fp);
|
|
|
|
|
if ((fp=fopen("student.bin","wb"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>");
|
|
|
|
|
readfromfile();
|
|
|
|
|
}
|
|
|
|
|
num=0;
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void deletebyname()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>
|
|
|
|
|
{
|
|
|
|
|
int a=0;
|
|
|
|
|
int findmark=0;
|
|
|
|
|
int j;
|
|
|
|
|
int deletemark=0;
|
|
|
|
|
int i;
|
|
|
|
|
char name[20];
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",name);
|
|
|
|
|
for (i=a;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(student[i].name,name)==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>¼<EFBFBD><EFBFBD>");
|
|
|
|
|
findmark++;
|
|
|
|
|
printf("\n\t\t________________________________");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD> %s",student[i].nativeplace);
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s",student[i].name);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰1<EFBFBD><EFBFBD> %s",student[i].phone1);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰2<EFBFBD><EFBFBD> %s",student[i].phone2);
|
|
|
|
|
printf("\n\t\te-mail<69><6C>%s",student[i].e_mail);
|
|
|
|
|
printf("\n\t\t________________________________");
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD>ɾ<EFBFBD><EFBFBD>?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
{
|
|
|
|
|
for (j=i;j<num-1;j++) /*<2A><>¼<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>stud<75><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>֮*/
|
|
|
|
|
student[j]=student[j+1];
|
|
|
|
|
num--;
|
|
|
|
|
deletemark++;
|
|
|
|
|
printf("\n\t\tɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
if((i+1)<num)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
{
|
|
|
|
|
a=i;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
deletebyname();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if((i+1)<num)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
{
|
|
|
|
|
a=i;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ((deletemark==0)&&(findmark==0))
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tû<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵ļ<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
deletebynativeplace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (findmark!=0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
printf("\n\t\tû<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵ļ<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
deletebynativeplace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void deleteone()//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
char choic;
|
|
|
|
|
printf("\n\t\t1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE> 2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
choic=getch();
|
|
|
|
|
switch (choic)
|
|
|
|
|
{
|
|
|
|
|
case '1':deletebynativeplace();break;
|
|
|
|
|
case '2':deletebyname();break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void deletebynativeplace()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>
|
|
|
|
|
{
|
|
|
|
|
int i,j;
|
|
|
|
|
int deletemark=0;
|
|
|
|
|
char nativeplace[20];
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˼<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",nativeplace);
|
|
|
|
|
if(num==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD>Բ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κμ<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (i=0;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(student[i].nativeplace,nativeplace)==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˼<EFBFBD>¼<EFBFBD><EFBFBD>");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD> %s",student[i].nativeplace);
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s",student[i].name);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰1<EFBFBD><EFBFBD> %s",student[i].phone1);
|
|
|
|
|
printf("\n\t\t<EFBFBD>绰2<EFBFBD><EFBFBD> %s",student[i].phone2);
|
|
|
|
|
printf("\n\t\te-mail<69><6C>%s",student[i].e_mail);
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD>ɾ<EFBFBD><EFBFBD>?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
{
|
|
|
|
|
for (j=i;j<num-1;j++) /*<2A><>¼<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>stud<75><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>֮*/
|
|
|
|
|
student[j]=student[j+1];
|
|
|
|
|
num--;
|
|
|
|
|
deletemark++;
|
|
|
|
|
printf("\n\t\tɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
deletebynativeplace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (deletemark==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tû<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵ļ<EFBFBD>¼");
|
|
|
|
|
printf("\n\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>?(y/n)");
|
|
|
|
|
if (getch()=='y')
|
|
|
|
|
deletebynativeplace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void writetofile()//д<><D0B4><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
if ((fp=fopen("student.bin","wb"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
for (i=0;i<num;i++)
|
|
|
|
|
{
|
|
|
|
|
if (fwrite(&student[i],sizeof(struct record),1,fp)!=1)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\tд<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("\n\t\tͨѶ¼<EFBFBD>ļ<EFBFBD><EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
printf("\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\t\t");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|