|
|
@ -3,8 +3,10 @@
|
|
|
|
#include<string.h>
|
|
|
|
#include<string.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#pragma comment(lib, "Winmm.lib")
|
|
|
|
#pragma comment(lib, "Winmm.lib")
|
|
|
|
|
|
|
|
#include<conio.h>
|
|
|
|
|
|
|
|
|
|
|
|
FILE *ptr1;
|
|
|
|
FILE *ptr1;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char name[20];
|
|
|
|
char name[20];
|
|
|
@ -12,14 +14,9 @@ typedef struct
|
|
|
|
int kind;
|
|
|
|
int kind;
|
|
|
|
char email[50];
|
|
|
|
char email[50];
|
|
|
|
} lm;
|
|
|
|
} lm;
|
|
|
|
typedef struct
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char user[20];
|
|
|
|
|
|
|
|
char pw[20];
|
|
|
|
|
|
|
|
int kind;
|
|
|
|
|
|
|
|
} User;
|
|
|
|
|
|
|
|
lm linkman,lkm;
|
|
|
|
lm linkman,lkm;
|
|
|
|
User user;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int *offset;
|
|
|
|
int *offset;
|
|
|
|
|
|
|
|
|
|
|
|
void add();
|
|
|
|
void add();
|
|
|
@ -30,9 +27,58 @@ void dial();
|
|
|
|
void amend();
|
|
|
|
void amend();
|
|
|
|
void head();
|
|
|
|
void head();
|
|
|
|
void whattodo();
|
|
|
|
void whattodo();
|
|
|
|
void zhuce();
|
|
|
|
int passwd();
|
|
|
|
|
|
|
|
int addpw();
|
|
|
|
|
|
|
|
int changepw();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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("程序初始化错误\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fscanf(ptr1,"%s",passwd);
|
|
|
|
|
|
|
|
if(ftell(ptr1)==0)return 50;
|
|
|
|
|
|
|
|
printf("欢迎您使用手机通讯录小程序\n");
|
|
|
|
|
|
|
|
printf("本程序已被设置隐私保护,请输入密码:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(pw);
|
|
|
|
|
|
|
|
if(strcmp(pw,passwd)==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("验证成功~\n");
|
|
|
|
|
|
|
|
Sleep(2000);
|
|
|
|
|
|
|
|
return 100;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("验证失败~\n");
|
|
|
|
|
|
|
|
while(strcmp(pw,passwd)!=0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("本程序已被设置隐私保护,请输入密码:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(pw);
|
|
|
|
|
|
|
|
if(strcmp(pw,passwd)==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("验证成功~\n");
|
|
|
|
|
|
|
|
Sleep(500);
|
|
|
|
|
|
|
|
return 100;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main_menu()
|
|
|
|
|
|
|
|
|
|
|
|
int main_menu(int flag)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
char c;
|
|
|
|
char c;
|
|
|
@ -46,7 +92,10 @@ int main_menu()
|
|
|
|
printf("\t\t │ │\n");
|
|
|
|
printf("\t\t │ │\n");
|
|
|
|
printf("\t\t │ 3. 查找联系人 4. 修改联系人 │\n");
|
|
|
|
printf("\t\t │ 3. 查找联系人 4. 修改联系人 │\n");
|
|
|
|
printf("\t\t │ │\n");
|
|
|
|
printf("\t\t │ │\n");
|
|
|
|
printf("\t\t │ 5. 设置用户 6. 拨号 │\n");
|
|
|
|
if(flag==50)
|
|
|
|
|
|
|
|
printf("\t\t │ 5. 设置密码保护 6. 拨号 │\n");
|
|
|
|
|
|
|
|
if(flag==100)
|
|
|
|
|
|
|
|
printf("\t\t │ 5. 修改密码保护 6. 拨号 │\n");
|
|
|
|
printf("\t\t │ │\n");
|
|
|
|
printf("\t\t │ │\n");
|
|
|
|
printf("\t\t │ 0. 退出程序 │\n");
|
|
|
|
printf("\t\t │ 0. 退出程序 │\n");
|
|
|
|
printf("\t\t └────────────────────────────────┘\n");
|
|
|
|
printf("\t\t └────────────────────────────────┘\n");
|
|
|
@ -57,9 +106,11 @@ int main_menu()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int flag;
|
|
|
|
|
|
|
|
flag=passwd();
|
|
|
|
while(1)
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch(main_menu())
|
|
|
|
switch(main_menu(flag))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
printf("\t\t --------新增联系人--------\n");
|
|
|
|
printf("\t\t --------新增联系人--------\n");
|
|
|
@ -78,8 +129,15 @@ main()
|
|
|
|
amend();
|
|
|
|
amend();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
case 5:
|
|
|
|
printf("\t\t --------删除联系人---------\n");
|
|
|
|
if(flag==100)
|
|
|
|
sc();
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\t\t --------修改密码保护---------\n");flag=changepw();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(flag==50)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\t\t --------设置密码保护---------\n");flag=addpw();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
case 6:
|
|
|
|
printf("\t\t -----------拨号------------\n");
|
|
|
|
printf("\t\t -----------拨号------------\n");
|
|
|
@ -451,9 +509,70 @@ void amend()
|
|
|
|
system("pause");
|
|
|
|
system("pause");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void sc()
|
|
|
|
int addpw()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
char pw[20];
|
|
|
|
|
|
|
|
ptr1=fopen("passwd.sto","wb");
|
|
|
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("无法设置密码\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
return 50;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("请输入20位以内的密码:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(pw);
|
|
|
|
|
|
|
|
fputs(pw,ptr1);
|
|
|
|
|
|
|
|
puts(pw);
|
|
|
|
|
|
|
|
printf("新建密码成功!");
|
|
|
|
|
|
|
|
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("无法修改密码\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
return 50;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fscanf(ptr1,"%s",oldpw);
|
|
|
|
|
|
|
|
pos_6:
|
|
|
|
|
|
|
|
printf("请输入您的旧密码:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(pw);
|
|
|
|
|
|
|
|
if(strcmp(pw,oldpw)!=0){
|
|
|
|
|
|
|
|
printf("密码错误!\n");goto pos_6;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pos_7:
|
|
|
|
|
|
|
|
printf("请输入您的新密码:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(newpw);
|
|
|
|
|
|
|
|
printf("请再次输入您的新密码:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(newpw2);
|
|
|
|
|
|
|
|
if(strcmp(newpw,newpw2)!=0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("两次输入的密码不同,需要重新输入!\n");
|
|
|
|
|
|
|
|
goto pos_7;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(ptr1);
|
|
|
|
|
|
|
|
ptr1=fopen("passwd.sto","wb");
|
|
|
|
|
|
|
|
if(ptr1==NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("无法修改密码\n");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
return 50;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(ptr1,"%s",newpw);
|
|
|
|
|
|
|
|
printf("密码修改成功\n");
|
|
|
|
|
|
|
|
Sleep(2000);
|
|
|
|
|
|
|
|
passwd();
|
|
|
|
|
|
|
|
return 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void dial()
|
|
|
|
void dial()
|
|
|
|
{
|
|
|
|
{
|
|
|
|