|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#define M 40 //<2F>궨<EFBFBD><EAB6A8>˵<EFBFBD><CBB5>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ50
|
|
|
|
|
FILE *fp; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ָ<EFBFBD><D6B8>
|
|
|
|
|
struct student /*<2A>ṹ<EFBFBD>嶨<EFBFBD>弰<EFBFBD><E5BCB0><EFBFBD><EFBFBD> */
|
|
|
|
|
{
|
|
|
|
|
char id[100]; /*ѧ<><D1A7>*/
|
|
|
|
|
char name[100]; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
char sex[50]; //<2F>Ա<EFBFBD>
|
|
|
|
|
char minzu[100]; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
char jiguan[100];//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
char adress[100]; //<2F><>ͥסַ
|
|
|
|
|
char num[100]; //<2F><>ϵ<EFBFBD>绰
|
|
|
|
|
char idcard[100]; //<2F><><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
|
|
|
|
|
} ;
|
|
|
|
|
void input(struct student stu[M]);//<2F><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
|
|
void show(struct student stu[M]); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
|
|
void seek(struct student stu[M]); //<2F><><EFBFBD>Һ<EFBFBD><D2BA><EFBFBD>
|
|
|
|
|
void add(struct student stu[M]); //<2F><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
|
|
void reduce(struct student stu[M]);//ɾ<><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
|
|
void filewrite(struct student stu[M]);//<2F><>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣд<CFA2><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void fileread(struct student stu[M]);//<2F><>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int count=0; //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>浱ǰѧ<C7B0><D1A7><EFBFBD><EFBFBD>
|
|
|
|
|
struct student stu[M];
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
char ce;
|
|
|
|
|
int choice; //<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
|
|
|
|
|
printf("\t\t\t\t<EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ\n");//չʾϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>
|
|
|
|
|
do {
|
|
|
|
|
printf("*****************************************************************\n");
|
|
|
|
|
printf("*\t\t\t\t+ ѧ<><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ϵͳ +\n");
|
|
|
|
|
printf("*\t\t\t\t-------------------------------------------------\n");
|
|
|
|
|
printf("*\t\t\t\t ***************\n");
|
|
|
|
|
printf("*\t\t\t\t 1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ *\n");
|
|
|
|
|
printf("*\t\t\t\t 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ *\n");
|
|
|
|
|
printf("*\t\t\t\t 3<><33><EFBFBD><EFBFBD>ѯѧ<D1AF><D1A7><EFBFBD><EFBFBD>Ϣ *\n");
|
|
|
|
|
printf("*\t\t\t\t 4<><34><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ *\n");
|
|
|
|
|
printf("*\t\t\t\t 5<><35>ɾ<EFBFBD><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ *\n");
|
|
|
|
|
printf("*\t\t\t\t 6<><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ļ<EFBFBD> *\n");
|
|
|
|
|
printf("*\t\t\t\t 7<><37><EFBFBD><EFBFBD>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ *\n");
|
|
|
|
|
printf("*\t\t\t\t 8<><38><EFBFBD>˳<EFBFBD>ϵͳ *\n");
|
|
|
|
|
printf("*****************************************************************\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
do{
|
|
|
|
|
scanf("%c", &ce);
|
|
|
|
|
}while(ce>'8' || ce<'1');
|
|
|
|
|
choice = ce - '0';
|
|
|
|
|
switch (choice)
|
|
|
|
|
{
|
|
|
|
|
case 1:input(stu);break;
|
|
|
|
|
case 2:show(stu);break;
|
|
|
|
|
case 3:seek(stu);break;
|
|
|
|
|
case 4:add(stu);break;
|
|
|
|
|
case 5:reduce(stu);break;
|
|
|
|
|
case 6:filewrite(stu);break;
|
|
|
|
|
case 7:fileread(stu);break;
|
|
|
|
|
case 8:printf("<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>");break;
|
|
|
|
|
default:printf("<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");break;
|
|
|
|
|
}
|
|
|
|
|
}while(choice!=8);
|
|
|
|
|
printf("the program is over!!!\n");
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void seek(struct student stu[M])//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Һ<EFBFBD><D2BA><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
FILE *FP;
|
|
|
|
|
//fp=fopen("f1.txt","r+");
|
|
|
|
|
char sh[20];
|
|
|
|
|
system("cls");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if(count==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ") ;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ͬѧѧ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",sh); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// fp=fopen("f1.txt","r+");
|
|
|
|
|
for (j=0;j<40;j++) ///ִ<><D6B4>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(stu[j].id,sh)==0)//ͨ<><CDA8><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ա<EFBFBD><D4B1>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ͥסַ\t\t<EFBFBD><EFBFBD>ϵ<EFBFBD>绰\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t\n");
|
|
|
|
|
printf("%s\t\t",stu[j].id);
|
|
|
|
|
printf("%s\t",stu[j].name);
|
|
|
|
|
printf("%s\t",stu[j].sex);
|
|
|
|
|
printf("%s\t",stu[j].minzu);
|
|
|
|
|
printf("%s\t",stu[j].jiguan);
|
|
|
|
|
printf("%s\t\t",stu[j].adress);
|
|
|
|
|
printf("%s\t\t",stu[j].num);
|
|
|
|
|
printf("%s",stu[j].idcard); break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(j==count)
|
|
|
|
|
printf("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void add(struct student stu[M])
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
// FILE *FP;
|
|
|
|
|
// fp=fopen("f1.txt","r+");
|
|
|
|
|
char ch[20];
|
|
|
|
|
system("cls");
|
|
|
|
|
if(count==0)
|
|
|
|
|
{
|
|
|
|
|
printf("û<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") ;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>ͬѧѧ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",&ch);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
// fp=fopen("f1.txt","r+");
|
|
|
|
|
for (i=0;i<40;i++) ///ִ<><D6B4>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(stu[i].id,ch)==0)
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ͥסַ\t\t<EFBFBD><EFBFBD>ϵ<EFBFBD>绰\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t ");
|
|
|
|
|
printf("%s%s%s%s%s%s%s%s",stu[i].id,stu[i].name,stu[i].sex,stu[i].minzu,stu[i].jiguan,stu[i].adress,stu[i].num,stu[i].idcard);
|
|
|
|
|
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>\n");
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ͥסַ\t\t<EFBFBD><EFBFBD>ϵ<EFBFBD>绰\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t");
|
|
|
|
|
scanf("%s%s%s%s%s%s%s%s",stu[i].id,stu[i].name,stu[i].sex,stu[i].minzu,stu[i].jiguan,stu[i].adress,stu[i].num,stu[i].idcard);break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void reduce(struct student stu[M])
|
|
|
|
|
{
|
|
|
|
|
int i=0,j,k=count;
|
|
|
|
|
char xh[20];
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%s",&xh);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
for (j=0;j<count;j++)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(stu[j].name,xh)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ͥסַ\t\t<EFBFBD><EFBFBD>ϵ<EFBFBD>绰\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t");
|
|
|
|
|
printf("%s%s%s%s%s%s%s%s%s",stu[j].id,stu[j].name,stu[j].sex,stu[j].minzu,stu[j].jiguan,stu[j].adress,stu[j].num,stu[j].idcard);
|
|
|
|
|
printf("ȷ<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
for (j=i;j<count;j++)
|
|
|
|
|
stu[j]=stu[j+1];
|
|
|
|
|
count--;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (count<k)
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ϣɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
i++;
|
|
|
|
|
if(count==j)
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ǹ!!!û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ!*_*!\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void filewrite(struct student stu[M])//<2F><>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣд<CFA2><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
char c;
|
|
|
|
|
FILE *fp; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ָ<EFBFBD><D6B8>
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ:'y'<27><><EFBFBD><EFBFBD>'n'???\n");
|
|
|
|
|
scanf("%s",&c);
|
|
|
|
|
//fflush(stdin);
|
|
|
|
|
// while(c!='y'&&c!='n')
|
|
|
|
|
// {
|
|
|
|
|
// if (c!='y'&&c!='n')
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("<22><><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ḳ<EFBFBD><E1B8B2><EFBFBD>Ѵ洢<D1B4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'y'<27><>'n'???\n");
|
|
|
|
|
// scanf("%c",&c);
|
|
|
|
|
// //fflush(stdin);
|
|
|
|
|
// }
|
|
|
|
|
//rintf("%s %s %s %s %s %s %s %s %s\n", stu[j].id,stu[j].name,stu[j].sex,stu[j].minzu,stu[j].jiguan,stu[j].adress,stu[j].num,stu[j].idcard);
|
|
|
|
|
if (c=='y')
|
|
|
|
|
{
|
|
|
|
|
if((fp=fopen("f1.txt","r+"))==NULL)//<2F>ж<EFBFBD><D0B6>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7>ɹ<F2BFAAB3>
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
for(j=0;j<count;j++)
|
|
|
|
|
{
|
|
|
|
|
//fprintf(fp, "%s %s %s %s %s %s %s %s %s\n", stu[j].id,stu[j].name,stu[j].sex,stu[j].minzu,stu[j].jiguan,stu[j].adress,stu[j].num,stu[j].idcard);
|
|
|
|
|
fprintf(fp,"%s\t",stu[j].id);
|
|
|
|
|
fprintf(fp,"%s\t",stu[j].name);
|
|
|
|
|
fprintf(fp,"%\t",stu[j].sex);
|
|
|
|
|
fprintf(fp,"%s\t",stu[j].minzu);
|
|
|
|
|
fprintf(fp,"%s\t",stu[j].jiguan);
|
|
|
|
|
fprintf(fp,"%s\t",stu[j].adress);
|
|
|
|
|
fprintf(fp,"%s\t",stu[j].num);
|
|
|
|
|
fprintf(fp,"%s\t",stu[j].idcard);
|
|
|
|
|
}
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void fileread(struct student stu[M]) //<2F><>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int j=0;
|
|
|
|
|
char c;
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ:'y'<27><><EFBFBD><EFBFBD>'n'???\n");
|
|
|
|
|
scanf("%s",&c);
|
|
|
|
|
FILE *fp;
|
|
|
|
|
// fflush(stdin);
|
|
|
|
|
// while(c!='y'&&c!='n')
|
|
|
|
|
// {
|
|
|
|
|
// if (c!='y'&&c!='n')
|
|
|
|
|
// printf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
// printf("<22><><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ḳ<EFBFBD><E1B8B2><EFBFBD>Ѵ洢<D1B4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'y'<27><>'n'???\n");
|
|
|
|
|
// scanf("%c",&c);
|
|
|
|
|
// fflush(stdin);
|
|
|
|
|
// }
|
|
|
|
|
if (c=='y')
|
|
|
|
|
{
|
|
|
|
|
if((fp=fopen("f1.txt","r+"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
// fread(&stu[j],sizeof(struct student),1,fp);
|
|
|
|
|
// count=0;
|
|
|
|
|
// count++;
|
|
|
|
|
// j++;
|
|
|
|
|
// while(fread(&stu[j],sizeof(struct student),1,fp))
|
|
|
|
|
// {
|
|
|
|
|
// j++;
|
|
|
|
|
// count++;
|
|
|
|
|
// }
|
|
|
|
|
//fprintf(fp, "%s %s %s %s %s %s %s %s %s\n", stu[j].id,stu[j].name,stu[j].sex,stu[j].minzu,stu[j].jiguan,stu[j].adress,stu[j].num,stu[j].idcard);
|
|
|
|
|
while(fscanf(fp,"%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t",stu[j].id,stu[j].name,stu[j].sex,stu[j].minzu,stu[j].jiguan,stu[j].adress,stu[j].num,stu[j].idcard)!=EOF)
|
|
|
|
|
{
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>!!!\n");
|
|
|
|
|
}
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void input(struct student stu[M]) //<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뺯<EFBFBD><EBBAAF>
|
|
|
|
|
{
|
|
|
|
|
char a;
|
|
|
|
|
system("cls");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>ѧ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:\n");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",stu[count].id);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
fflush(stdin);//
|
|
|
|
|
scanf("%s",stu[count].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",stu[count].sex);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>壺\n");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",stu[count].minzu);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",stu[count].jiguan);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͥסַ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",stu[count].adress);
|
|
|
|
|
printf("<EFBFBD>绰\n");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",stu[count].num);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>18λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD>룺\n");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",stu[count].idcard);
|
|
|
|
|
count++;
|
|
|
|
|
// printf("<22>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>棿y/n");
|
|
|
|
|
// scanf("%s",&a);
|
|
|
|
|
// if(a=='y')
|
|
|
|
|
// {
|
|
|
|
|
// //filewrite(stu);
|
|
|
|
|
// input(stu);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// printf("<22><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>洢");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void show(struct student stu[M])//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
system("cls");
|
|
|
|
|
if (count==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ǰѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢΪ0<EFBFBD><EFBFBD>\n");
|
|
|
|
|
// return;
|
|
|
|
|
}
|
|
|
|
|
for(j=0; j<count; j++)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ͥסַ\t\t<EFBFBD><EFBFBD>ϵ<EFBFBD>绰\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n") ;
|
|
|
|
|
for(j=0; j<10; j++)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\t\t",stu[j].id);
|
|
|
|
|
printf("%s\t",stu[j].name);
|
|
|
|
|
printf("%s\t",stu[j].sex);
|
|
|
|
|
printf("%s\t",stu[j].minzu);
|
|
|
|
|
printf("%s\t",stu[j].jiguan);
|
|
|
|
|
printf("%s\t\t",stu[j].adress);
|
|
|
|
|
printf("%s\t\t",stu[j].num);
|
|
|
|
|
printf("%s\n",stu[j].idcard);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|