|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#pragma comment(lib, "Winmm.lib")
|
|
|
|
|
#include<conio.h>
|
|
|
|
|
|
|
|
|
|
FILE *ptr1;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
char name[20];
|
|
|
|
|
char phonenum[20];
|
|
|
|
|
int kind;
|
|
|
|
|
char email[50];
|
|
|
|
|
} lm;
|
|
|
|
|
lm linkman,lkm;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int flag2,p,flag3;
|
|
|
|
|
char e_num;
|
|
|
|
|
|
|
|
|
|
void add();
|
|
|
|
|
void view();
|
|
|
|
|
void search();
|
|
|
|
|
void sc();
|
|
|
|
|
void dial();
|
|
|
|
|
void amend();
|
|
|
|
|
void head();
|
|
|
|
|
void whattodo();
|
|
|
|
|
int passwd();
|
|
|
|
|
int addpw();
|
|
|
|
|
int changepw();
|
|
|
|
|
void color(short x) //<2F>Զ<EFBFBD><D4B6>庯<EFBFBD><E5BAAF><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ɫ
|
|
|
|
|
{
|
|
|
|
|
if(x>=0 && x<=15)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-15<31>ķ<EFBFBD>Χ<EFBFBD><CEA7>ɫ
|
|
|
|
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x); //ֻ<><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
else//Ĭ<>ϵ<EFBFBD><CFB5><EFBFBD>ɫ<EFBFBD><C9AB>ɫ
|
|
|
|
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int passwd()
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
char passwd[20],pw[20];
|
|
|
|
|
ptr1=fopen("passwd.sto","rb+");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
if((ptr1=fopen("passwd.sto","wb+"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fscanf(ptr1,"%s",passwd);
|
|
|
|
|
if(ftell(ptr1)==0)return 50;
|
|
|
|
|
printf("<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>룺");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(pw);
|
|
|
|
|
if(strcmp(pw,passwd)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>֤<EFBFBD>ɹ<EFBFBD>~\n");
|
|
|
|
|
Sleep(2000);
|
|
|
|
|
return 100;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>֤ʧ<EFBFBD><EFBFBD>~\n");
|
|
|
|
|
while(strcmp(pw,passwd)!=0)
|
|
|
|
|
{
|
|
|
|
|
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>룺");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(pw);
|
|
|
|
|
if(strcmp(pw,passwd)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>֤<EFBFBD>ɹ<EFBFBD>~\n");
|
|
|
|
|
Sleep(500);
|
|
|
|
|
return 100;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main_menu(int flag)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
char c;
|
|
|
|
|
do{
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\t\t <20>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T\n");
|
|
|
|
|
printf("\t\t <20>ֻ<EFBFBD>ͨѶ¼С<C2BC><D0A1><EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t\t <20>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T\n");
|
|
|
|
|
printf("\t\t <20><><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><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("\t\t <20><> 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5> 2. ȫ<><C8AB><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5> <20><>\n");
|
|
|
|
|
printf("\t\t <20><> <20><>\n");
|
|
|
|
|
printf("\t\t <20><> 3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5> 4. <20><EFBFBD><DEB8><EFBFBD>ϵ<EFBFBD><CFB5> <20><>\n");
|
|
|
|
|
printf("\t\t <20><> <20><>\n");
|
|
|
|
|
if(flag==50)
|
|
|
|
|
printf("\t\t <20><> 5. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뱣<EFBFBD><EBB1A3> 6. <20><><EFBFBD><EFBFBD> <20><>\n");
|
|
|
|
|
if(flag==100)
|
|
|
|
|
printf("\t\t <20><> 5. <20><EFBFBD><DEB8><EFBFBD><EFBFBD>뱣<EFBFBD><EBB1A3> 6. <20><><EFBFBD><EFBFBD> <20><>\n");
|
|
|
|
|
printf("\t\t <20><> <20><>\n");
|
|
|
|
|
printf("\t\t <20><> 0. <20>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD> <20><>\n");
|
|
|
|
|
printf("\t\t <20><><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><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("\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>(0-6):");
|
|
|
|
|
c=getchar();
|
|
|
|
|
}while(c<'0'||c>'6');
|
|
|
|
|
return (c-'0');
|
|
|
|
|
}
|
|
|
|
|
main()
|
|
|
|
|
{
|
|
|
|
|
int flag;
|
|
|
|
|
flag=passwd();
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
switch(main_menu(flag))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
printf("\t\t --------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>--------\n");
|
|
|
|
|
add();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
printf("\t\t --------ȫ<><C8AB><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>--------\n");
|
|
|
|
|
view();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
printf("\t\t --------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>--------\n");
|
|
|
|
|
search();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
printf("\t\t --------<2D><EFBFBD><DEB8><EFBFBD>ϵ<EFBFBD><CFB5>--------\n");
|
|
|
|
|
amend();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
if(flag==100)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t --------<2D><EFBFBD><DEB8><EFBFBD><EFBFBD>뱣<EFBFBD><EBB1A3>---------\n");flag=changepw();
|
|
|
|
|
}
|
|
|
|
|
if(flag==50)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t --------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뱣<EFBFBD><EBB1A3>---------\n");flag=addpw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
printf("\t\t -----------<2D><><EFBFBD><EFBFBD>------------\n");
|
|
|
|
|
dial();
|
|
|
|
|
break;
|
|
|
|
|
case 0:
|
|
|
|
|
printf("<EFBFBD><EFBFBD>лʹ<EFBFBD>ã<EFBFBD><EFBFBD>ټ<EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
exit(0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
void add()
|
|
|
|
|
{
|
|
|
|
|
int i=0,flag;
|
|
|
|
|
char kind;
|
|
|
|
|
ptr1=fopen("storage.sto","rb+");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
ptr1=fopen("storage.sto","wb+");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
//printf("%s\n",linkman.name);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
if(ftell(ptr1)==0)i=0;
|
|
|
|
|
fseek(ptr1,0,SEEK_END);
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ŀǰ<EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(%d/15)\n",i,15-i,i);
|
|
|
|
|
if(i==15)
|
|
|
|
|
{
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
char ch='y';
|
|
|
|
|
while(ch!='n'&&ch!='N')
|
|
|
|
|
{
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
++i;
|
|
|
|
|
pos_1:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
gets(lkm.name);
|
|
|
|
|
if(strlen(lkm.name)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_1;
|
|
|
|
|
}
|
|
|
|
|
for(p=0;p<strlen(lkm.name);p++)
|
|
|
|
|
{
|
|
|
|
|
if(lkm.name[p]==' ')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
flag=0;
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
if(strcmp(linkman.name,lkm.name)==0)
|
|
|
|
|
{
|
|
|
|
|
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>\n");
|
|
|
|
|
goto pos_1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos_2:
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD>绰<EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
gets(lkm.phonenum);
|
|
|
|
|
if(strlen(lkm.phonenum)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_2;
|
|
|
|
|
}
|
|
|
|
|
for(p=0;p<strlen(lkm.phonenum);p++)
|
|
|
|
|
{
|
|
|
|
|
if(lkm.phonenum[p]==' ')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(p=0,flag2=0;p<strlen(lkm.phonenum);p++)
|
|
|
|
|
{
|
|
|
|
|
if(lkm.phonenum[p]<'0'||lkm.phonenum[p]>'9')
|
|
|
|
|
{
|
|
|
|
|
flag2=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(flag2)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_2;
|
|
|
|
|
}
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
if(strcmp(linkman.phonenum,lkm.phonenum)==0)
|
|
|
|
|
{
|
|
|
|
|
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>\n");
|
|
|
|
|
goto pos_2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ࣨ1 <20>칫<EFBFBD><ECB9AB> 2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3 <20><><EFBFBD><EFBFBD><EFBFBD>ࣩ<EFBFBD><E0A3A9>");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
kind=getchar();
|
|
|
|
|
while(kind<'0'||kind>'3')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-3<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
kind=getchar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(kind=='1')lkm.kind=1;
|
|
|
|
|
if(kind=='2')lkm.kind=2;
|
|
|
|
|
if(kind=='3')lkm.kind=3;
|
|
|
|
|
|
|
|
|
|
pos_7:
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣺");
|
|
|
|
|
gets(lkm.email);
|
|
|
|
|
|
|
|
|
|
for(p=0,flag2=1;p<strlen(lkm.email);p++)
|
|
|
|
|
{
|
|
|
|
|
if(lkm.email[p]=='@')
|
|
|
|
|
{
|
|
|
|
|
flag2=0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(flag2)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_7;
|
|
|
|
|
}
|
|
|
|
|
fseek(ptr1,0,2);
|
|
|
|
|
fprintf(ptr1, "%20s%20s%5d%50s\n",lkm.name,lkm.phonenum,lkm.kind,lkm.email);
|
|
|
|
|
if(i<15)
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>%d<><64><EFBFBD><EFBFBD>ϵ<EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD>ϵ<EFBFBD>ˣ<EFBFBD>y/n<><6E>",i,15-i);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>%d<><64><EFBFBD><EFBFBD>ϵ<EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>ˣ<EFBFBD>y/n<><6E>",i,15-i);
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
ch=getchar();
|
|
|
|
|
}
|
|
|
|
|
fclose(ptr1);
|
|
|
|
|
}
|
|
|
|
|
void view()
|
|
|
|
|
{
|
|
|
|
|
int x,i=0;
|
|
|
|
|
ptr1=fopen("storage.sto","rb+");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
whattodo();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
if(ftell(ptr1)==0)
|
|
|
|
|
{
|
|
|
|
|
whattodo();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>鿴<EFBFBD><EFBFBD>ϵ<EFBFBD>˵ķ<EFBFBD>Χ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>칫<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>4<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
e_num=getchar();
|
|
|
|
|
while(e_num<'1'||e_num>'4')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-4<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
e_num=getchar();
|
|
|
|
|
}
|
|
|
|
|
if(e_num=='1')x=1;
|
|
|
|
|
if(e_num=='2')x=2;
|
|
|
|
|
if(e_num=='3')x=3;
|
|
|
|
|
if(e_num=='4')x=4;
|
|
|
|
|
|
|
|
|
|
head();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
|
|
|
|
|
|
|
|
|
if(x==1)
|
|
|
|
|
{
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
|
|
|
|
|
//printf("%d %-10s %-10s %d %-10s",i,linkman.name,linkman.phonenum,linkman.kind,linkman.email);
|
|
|
|
|
if(linkman.kind==1)
|
|
|
|
|
printf("%2d %-10s %-20s <20>칫<EFBFBD><ECB9AB> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);
|
|
|
|
|
if(linkman.kind==2)
|
|
|
|
|
printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);
|
|
|
|
|
if(linkman.kind==3)
|
|
|
|
|
printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 2:if(linkman.kind==1)printf("%2d %-10s %-20s <20>칫<EFBFBD><ECB9AB> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);break;
|
|
|
|
|
case 3:if(linkman.kind==2)printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);break;
|
|
|
|
|
case 4:if(linkman.kind==3)printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>ʾȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD>%d<><64>\n",i);
|
|
|
|
|
system("pause");
|
|
|
|
|
fclose(ptr1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void search()
|
|
|
|
|
{
|
|
|
|
|
int x,i=0,u=0;
|
|
|
|
|
ptr1=fopen("storage.sto","rb+");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ŀǰû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵ļ<EFBFBD>¼\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
while(x<1||x>3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-3<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
}
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 1:return;break;
|
|
|
|
|
case 2:void add();break;
|
|
|
|
|
case 3:exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
if(ftell(ptr1)==0)
|
|
|
|
|
{
|
|
|
|
|
whattodo();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>밴<EFBFBD><EFBFBD>ʲô<EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>4<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>5<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>\n");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
while(x<1||x>5)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-5<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
}
|
|
|
|
|
if(x==5)return;
|
|
|
|
|
char keywords[20];
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
gets(keywords);
|
|
|
|
|
head();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
|
|
|
|
|
if(x==1)
|
|
|
|
|
{
|
|
|
|
|
if(keywords[0]>=0)
|
|
|
|
|
{
|
|
|
|
|
if(keywords[0]==linkman.name[0])u=1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if(keywords[0]==linkman.name[0]&&keywords[1]==linkman.name[1])u=1;
|
|
|
|
|
}
|
|
|
|
|
if(x==2)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(keywords,linkman.name)==0)u=1;
|
|
|
|
|
}
|
|
|
|
|
if(x==3)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(keywords,linkman.phonenum)==0)u=1;
|
|
|
|
|
}
|
|
|
|
|
if(x==4)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(keywords,linkman.email)==0)u=1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(u)
|
|
|
|
|
{
|
|
|
|
|
switch(linkman.kind)
|
|
|
|
|
{
|
|
|
|
|
case 1:printf("%2d %-10s %-20s <20>칫<EFBFBD><ECB9AB> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);break;
|
|
|
|
|
case 2:printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);break;
|
|
|
|
|
case 3:printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,linkman.name,linkman.phonenum,linkman.email);break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
u=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>ʾȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64>\n",i);
|
|
|
|
|
system("pause");
|
|
|
|
|
fclose(ptr1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void amend()
|
|
|
|
|
{
|
|
|
|
|
int x,i=0,flag,k,j,q;
|
|
|
|
|
lm array[15];
|
|
|
|
|
ptr1=fopen("storage.sto","rb+");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ŀǰû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵ļ<EFBFBD>¼\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
while(x<1||x>3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-3<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
}
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 1:return;break;
|
|
|
|
|
case 2:add();return;break;
|
|
|
|
|
case 3:exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
if(ftell(ptr1)==0)
|
|
|
|
|
{
|
|
|
|
|
whattodo();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
head();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
|
|
|
|
i=0;
|
|
|
|
|
j=0;
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",array[j].name,array[j].phonenum,&array[j].kind,array[j].email);
|
|
|
|
|
|
|
|
|
|
//printf("%2d %-10s %-20s <20>칫<EFBFBD><ECB9AB> %-10s\n",++i,array[j].name,array[j].phonenum,array[j].email);
|
|
|
|
|
|
|
|
|
|
if(array[j].kind==1)
|
|
|
|
|
printf("%2d %-10s %-20s <20>칫<EFBFBD><ECB9AB> %-10s\n",++i,array[j].name,array[j].phonenum,array[j].email);
|
|
|
|
|
if(array[j].kind==2)
|
|
|
|
|
printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,array[j].name,array[j].phonenum,array[j].email);
|
|
|
|
|
if(array[j].kind==3)
|
|
|
|
|
printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,array[j].name,array[j].phonenum,array[j].email);
|
|
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>1-%d<><64>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><EFBFBD>/ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>",i);
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
while(x<=0||x>i)
|
|
|
|
|
{
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>1-%d<><64>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><EFBFBD>/ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>",i);
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
q=i;//<2F>洢i<E6B4A2><69>ֵ;
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>:\n<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&flag);
|
|
|
|
|
while(flag<1||flag>2)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1/2<><32>");
|
|
|
|
|
scanf("%d",&flag);
|
|
|
|
|
}
|
|
|
|
|
if(flag==2)goto pos_3;
|
|
|
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD>ĵ<DEB8><C4B5><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
char ch;
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD>(y/n)",array[x-1].name);
|
|
|
|
|
ch=getchar();
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
if(ch=='y'||ch=='Y')
|
|
|
|
|
{
|
|
|
|
|
pos_10:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(array[x-1].name);
|
|
|
|
|
if(strlen(array[x-1].name)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_10;
|
|
|
|
|
}
|
|
|
|
|
for(p=0;p<strlen(array[x-1].name);p++)
|
|
|
|
|
{
|
|
|
|
|
if(array[x-1].name[p]==' ')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_10;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
if(strcmp(linkman.name,array[x-1].name)==0)
|
|
|
|
|
{
|
|
|
|
|
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>\n");
|
|
|
|
|
goto pos_10;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20>ĵ绰<C4B5><E7BBB0><EFBFBD><EFBFBD> %s (y/n)",array[x-1].name,array[x-1].phonenum);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
ch=getchar();
|
|
|
|
|
if(ch=='y'||ch=='Y')
|
|
|
|
|
{
|
|
|
|
|
pos_9:
|
|
|
|
|
printf("<EFBFBD>绰<EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(array[x-1].phonenum);
|
|
|
|
|
if(strlen(array[x-1].phonenum)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_9;
|
|
|
|
|
}
|
|
|
|
|
for(p=0;p<strlen(array[x-1].phonenum);p++)
|
|
|
|
|
{
|
|
|
|
|
if(array[x-1].phonenum[p]==' ')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_9;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(p=0,flag3=0;p<strlen(array[x-1].phonenum);p++)
|
|
|
|
|
{
|
|
|
|
|
if(array[x-1].phonenum[p]<'0'||array[x-1].phonenum[p]>'9')
|
|
|
|
|
{
|
|
|
|
|
flag3=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(flag3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_9;
|
|
|
|
|
}
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
if(strcmp(linkman.phonenum,array[x-1].phonenum)==0)
|
|
|
|
|
{
|
|
|
|
|
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>\n");
|
|
|
|
|
goto pos_9;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><EFBFBD><EFBFBD> ");
|
|
|
|
|
switch(array[x-1].kind)
|
|
|
|
|
{
|
|
|
|
|
case 1:printf("<EFBFBD>칫<EFBFBD><EFBFBD>");break;
|
|
|
|
|
case 2:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");break;
|
|
|
|
|
case 3:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");break;
|
|
|
|
|
}
|
|
|
|
|
printf(" (y/n)");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
ch=getchar();
|
|
|
|
|
if(ch=='y'||ch=='Y')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ࣨ1 <20>칫<EFBFBD><ECB9AB> 2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3 <20><><EFBFBD><EFBFBD><EFBFBD>ࣩ<EFBFBD><E0A3A9>");
|
|
|
|
|
scanf("%d",&array[x-1].kind);
|
|
|
|
|
|
|
|
|
|
while(lkm.kind<0||lkm.kind>3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-3<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
scanf("%d",&array[x-1].kind);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s (y/n)",array[x-1].name,array[x-1].email);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
ch=getchar();
|
|
|
|
|
if(ch=='y'||ch=='Y')
|
|
|
|
|
{
|
|
|
|
|
pos_8:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣺");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(array[x-1].email);
|
|
|
|
|
for(p=0,flag3=1;p<strlen(array[x-1].email);p++)
|
|
|
|
|
{
|
|
|
|
|
if(array[x-1].email[p]=='@')
|
|
|
|
|
{
|
|
|
|
|
flag3=0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(flag3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto pos_8;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pos_3:
|
|
|
|
|
i=0;
|
|
|
|
|
fclose(ptr1);
|
|
|
|
|
ptr1=fopen("storage.sto","wb");
|
|
|
|
|
i=0;
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
pos_4:
|
|
|
|
|
while(i<q)
|
|
|
|
|
{
|
|
|
|
|
if(x==(i+1)&&flag==2)
|
|
|
|
|
{
|
|
|
|
|
i++;continue;
|
|
|
|
|
}
|
|
|
|
|
fprintf(ptr1, "%20s%20s%5d%50s\n",array[i].name,array[i].phonenum,array[i].kind,array[i].email);
|
|
|
|
|
//printf("%20s%20s%5d%50s",array[i].name,array[i].phonenum,array[i].kind,array[i].email);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
fclose(ptr1);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD>ijɹ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
int addpw()
|
|
|
|
|
{
|
|
|
|
|
char pw[20];
|
|
|
|
|
ptr1=fopen("passwd.sto","wb");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return 50;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20λ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(pw);
|
|
|
|
|
fputs(pw,ptr1);
|
|
|
|
|
//puts(pw);
|
|
|
|
|
printf("<EFBFBD>½<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!");
|
|
|
|
|
fclose(ptr1);
|
|
|
|
|
system("pause");
|
|
|
|
|
passwd();
|
|
|
|
|
return 100;
|
|
|
|
|
}
|
|
|
|
|
int changepw()
|
|
|
|
|
{
|
|
|
|
|
char oldpw[20],newpw[20],newpw2[20],pw[20];
|
|
|
|
|
ptr1=fopen("passwd.sto","rb+");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return 50;
|
|
|
|
|
}
|
|
|
|
|
fscanf(ptr1,"%s",oldpw);
|
|
|
|
|
pos_6:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(pw);
|
|
|
|
|
if(strcmp(pw,oldpw)!=0){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");goto pos_6;
|
|
|
|
|
}
|
|
|
|
|
pos_7:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(newpw);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(newpw2);
|
|
|
|
|
if(strcmp(newpw,newpw2)!=0)
|
|
|
|
|
{
|
|
|
|
|
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>!\n");
|
|
|
|
|
goto pos_7;
|
|
|
|
|
}
|
|
|
|
|
fclose(ptr1);
|
|
|
|
|
ptr1=fopen("passwd.sto","wb");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
return 50;
|
|
|
|
|
}
|
|
|
|
|
fprintf(ptr1,"%s",newpw);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ijɹ<EFBFBD>\n");
|
|
|
|
|
Sleep(2000);
|
|
|
|
|
passwd();
|
|
|
|
|
return 100;
|
|
|
|
|
}
|
|
|
|
|
void dial()
|
|
|
|
|
{
|
|
|
|
|
int x,i=0,flag,k,j,q;
|
|
|
|
|
lm array[15];
|
|
|
|
|
ptr1=fopen("storage.sto","rb+");
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ŀǰû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵ļ<EFBFBD>¼\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
while(x<1||x>3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-3<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
}
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 1:return;break;
|
|
|
|
|
case 2:add();return;break;
|
|
|
|
|
case 3:exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",linkman.name,linkman.phonenum,&linkman.kind,linkman.email);
|
|
|
|
|
if(ftell(ptr1)==0)
|
|
|
|
|
{
|
|
|
|
|
whattodo();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
head();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
|
|
|
|
i=0;
|
|
|
|
|
j=0;
|
|
|
|
|
rewind(ptr1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(!feof(ptr1))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
fscanf(ptr1, "%s%s%d%s",array[j].name,array[j].phonenum,&array[j].kind,array[j].email);
|
|
|
|
|
|
|
|
|
|
//printf("%2d %-10s %-20s <20>칫<EFBFBD><ECB9AB> %-10s\n",++i,array[j].name,array[j].phonenum,array[j].email);
|
|
|
|
|
|
|
|
|
|
if(array[j].kind==1)
|
|
|
|
|
printf("%2d %-10s %-20s <20>칫<EFBFBD><ECB9AB> %-10s\n",++i,array[j].name,array[j].phonenum,array[j].email);
|
|
|
|
|
if(array[j].kind==2)
|
|
|
|
|
printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,array[j].name,array[j].phonenum,array[j].email);
|
|
|
|
|
if(array[j].kind==3)
|
|
|
|
|
printf("%2d %-10s %-20s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %-10s\n",++i,array[j].name,array[j].phonenum,array[j].email);
|
|
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>1-%d<><64>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>",i);
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
while(x<=0||x>i)
|
|
|
|
|
{
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>1-%d<><64>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>",i);
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");Sleep(200);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");Sleep(200);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");Sleep(200);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>\t");Sleep(200);
|
|
|
|
|
for(q=0;q<strlen(array[x-1].phonenum);q++)
|
|
|
|
|
{
|
|
|
|
|
printf("%c",array[x-1].phonenum[q]);
|
|
|
|
|
Sleep(300);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sleep(1500);
|
|
|
|
|
printf("\t");
|
|
|
|
|
for(q=0;q<50-strlen(array[x-1].phonenum);q++)
|
|
|
|
|
{
|
|
|
|
|
printf("*");
|
|
|
|
|
Sleep(20);
|
|
|
|
|
}
|
|
|
|
|
Sleep(1500);
|
|
|
|
|
color(10);
|
|
|
|
|
printf("[<5B><><EFBFBD><EFBFBD>]\n");
|
|
|
|
|
color(16);
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void head()
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>\n");
|
|
|
|
|
printf("***************************************************************************\n");
|
|
|
|
|
}
|
|
|
|
|
void whattodo()
|
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ŀǰû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>˵ļ<EFBFBD>¼\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
while(x<1||x>3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-3<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>֣<EFBFBD>");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
}
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case 1:return;break;
|
|
|
|
|
case 2:add();return;break;
|
|
|
|
|
case 3:exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|