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.

104 lines
1.8 KiB

6 years ago
#include <stdio.h>
#include <process.h>
#include <stdlib.h>
#include <string.h>
//<2F><><EFBFBD><EFBFBD><E5BAAF>
FILE *fp; //<2F>ļ<EFBFBD>ָ<EFBFBD><D6B8>
void menu();
void add();
void search();
void modify();
void look();
void quit();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int main()
{
menu();
return 0;
}
//ͨѶ¼<D1B6><EFBFBD><E1B9B9>
struct user
{
char name[8]; //<2F><><EFBFBD><EFBFBD>
char place[15]; //<2F><><EFBFBD><EFBFBD>
char tel1[15]; //<2F>绰1
char tel2[15]; //<2F>绰2
char email[20]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}user[50];
//<2F>˵<EFBFBD>
void menu()
{
system("cls");
system("color f3");
int n;
printf("\n\n\n\n\n");
printf("\t\t:---------ͨѶ¼---------:\n");
printf("\t\t: 1:<3A>½<EFBFBD> :\n");
printf("\t\t: 2:<3A><>ѯ :\n");
printf("\t\t: 3:<3A>޸<EFBFBD> :\n");
printf("\t\t: 4:<3A><><EFBFBD><EFBFBD> :\n");
printf("\t\t: 5:<3A>˳<EFBFBD> :\n");
printf("\t\t:--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <1-5>ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>--:\n\n");
scanf("%d",&n);
switch(n)
{
case 1: add(); break; //<2F><><EFBFBD><EFBFBD>
case 2: search(); break; //<2F><>ѯ
case 3: modify(); break; //<2F>޸<EFBFBD>
case 4: look(); break; //<2F><><EFBFBD><EFBFBD>
case 5: return; break; //<2F>˳<EFBFBD>
default: return;
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
void add()
{
struct user one;
system("color e3");
if((fp=fopen("user.txt","ab"))==NULL)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
exit(0);
}
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",one.name);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",one.place);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>");
scanf("%s",one.tel1);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>");
scanf("%s",one.tel2);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",one.email);
fwrite(&one,sizeof(struct user),1,fp); //<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>¼<EFBFBD><C2BC>user.txt<78><74>
fclose(fp);
printf("\nע<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
system("pause");
menu();
};
//<2F>޸<EFBFBD>
void modify()
{
menu();
}
//<2F><>ѯ
void search()
{
menu();
}
//<2F><><EFBFBD><EFBFBD>
void look()
{
menu();
return;
}
//<2F>˳<EFBFBD>
void quit()
{
return;
}