|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
|
|
|
|
|
void student_add();
|
|
|
|
|
void student_ll();
|
|
|
|
|
void student_xhcx();
|
|
|
|
|
void student_xmcx();
|
|
|
|
|
void student_xg();
|
|
|
|
|
void student_sc();
|
|
|
|
|
int flag=1;
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
int xuanze;
|
|
|
|
|
system("cls");
|
|
|
|
|
loop:
|
|
|
|
|
printf("\t\t\t\t********** ѧ<><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ϵͳ **********");
|
|
|
|
|
printf("\n\n\n\n");
|
|
|
|
|
printf("\t\t\t\t 1.ѧ<><D1A7><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC> \n");
|
|
|
|
|
printf("\t\t\t\t 2.ѧ<><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t\t\t\t 3.ѧ<>Ų<EFBFBD>ѯϵͳ \n");
|
|
|
|
|
printf("\t\t\t\t 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯϵͳ \n");
|
|
|
|
|
printf("\t\t\t\t 5.ѧ<><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t\t\t\t 6.ѧ<><D1A7><EFBFBD><EFBFBD>Ϣɾ<CFA2><C9BE> \n");
|
|
|
|
|
printf("\t\t\t\t 0.<2E>˳<EFBFBD>ϵͳ \n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>(0-6): \n");
|
|
|
|
|
scanf("%d",&xuanze);
|
|
|
|
|
switch(xuanze)
|
|
|
|
|
{
|
|
|
|
|
case 0:break;
|
|
|
|
|
case 1:student_add();break;
|
|
|
|
|
case 2:student_ll();break;
|
|
|
|
|
case 3:student_xhcx();break;
|
|
|
|
|
case 4:student_xmcx();break;
|
|
|
|
|
case 5:student_xg();break;
|
|
|
|
|
case 6:student_sc();break;
|
|
|
|
|
default:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");goto loop;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef struct student
|
|
|
|
|
{
|
|
|
|
|
char xuehao[20];
|
|
|
|
|
char xingming[20];
|
|
|
|
|
char nianling[20];
|
|
|
|
|
char xingbie[20];
|
|
|
|
|
char nianyue[20];
|
|
|
|
|
char dizhi[1000];
|
|
|
|
|
char dianhua[20];
|
|
|
|
|
char email[1000];
|
|
|
|
|
}stu;
|
|
|
|
|
|
|
|
|
|
void student_add()
|
|
|
|
|
{
|
|
|
|
|
int main();
|
|
|
|
|
FILE *fp;
|
|
|
|
|
struct student stu;
|
|
|
|
|
int n;
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
system("cls");
|
|
|
|
|
fp=fopen("student.txt","a+");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
printf("open file error!");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
while(flag)
|
|
|
|
|
{
|
|
|
|
|
for(int i=1;i<=n;i++)
|
|
|
|
|
{
|
|
|
|
|
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>¡<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>绰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣺\n");
|
|
|
|
|
scanf("%s%s%s%s%s%s%s%s",stu.xuehao,stu.xingming,stu.nianling,stu.xingbie,stu.nianyue,stu.dizhi,stu.dianhua,stu.email);
|
|
|
|
|
fprintf(fp,"%s %s %s %s %s %s %s %s\n",stu.xuehao,stu.xingming,stu.nianling,stu.xingbie,stu.nianyue,stu.dizhi,stu.dianhua,stu.email);
|
|
|
|
|
printf(" press '1'to continue,'0' exit:");
|
|
|
|
|
scanf("%d",&flag);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
main();
|
|
|
|
|
}
|
|
|
|
|
void student_ll()
|
|
|
|
|
{
|
|
|
|
|
char a[50],b[50],c[50],d[50],e[50],f[50],g[50],h[50];
|
|
|
|
|
system("cls");
|
|
|
|
|
freopen("student.txt","r",stdin);
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ա<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ַ <20>绰 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
while(scanf("%s%s%s%s%s%s%s%s",a,b,c,d,e,f,g,h)!=EOF)
|
|
|
|
|
{
|
|
|
|
|
printf("%s %s %s %s %s %s %s %s\n",a,b,c,d,e,f,g,h);
|
|
|
|
|
}
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
void student_xhcx()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
struct student stu;
|
|
|
|
|
char xh[20];
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ͬѧѧ<EFBFBD>ţ<EFBFBD>\n");
|
|
|
|
|
scanf("%s",xh);
|
|
|
|
|
fp=fopen("student.txt","r");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
printf("open file error!");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for(;!feof(fp);)
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%s%s%s%s%s%s%s%s",stu.xuehao,stu.xingming,stu.nianling,stu.xingbie,stu.nianyue,stu.dizhi,stu.dianhua,stu.email);
|
|
|
|
|
if(strcmp(xh,stu.xuehao)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD>ͬѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("%s %s %s %s %s %s %s %s\n",stu.xuehao,stu.xingming,stu.nianling,stu.xingbie,stu.nianyue,stu.dizhi,stu.dianhua,stu.email);
|
|
|
|
|
}
|
|
|
|
|
if(strcmp(xh,stu.xuehao)!=0)
|
|
|
|
|
printf("û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>鿴<EFBFBD><EFBFBD>ͬѧ<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>Ϣ!<21><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD>!\n");break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
void student_xmcx()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
struct student stu;
|
|
|
|
|
char xm[40];
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ͬѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",xm);
|
|
|
|
|
fp=fopen("student.txt","r");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
printf("open file error!");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for(;!feof(fp);)
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%s%s%s%s%s%s%s%s",stu.xuehao,stu.xingming,stu.nianling,stu.xingbie,stu.nianyue,stu.dizhi,stu.dianhua,stu.email);
|
|
|
|
|
if(strcmp(xm,stu.xingming)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD>ͬѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("%s %s %s %s %s %s %s %s\n",stu.xuehao,stu.xingming,stu.nianling,stu.xingbie,stu.nianyue,stu.dizhi,stu.dianhua,stu.email);
|
|
|
|
|
}
|
|
|
|
|
if(strcmp(xm,stu.xingming)!=0)
|
|
|
|
|
printf("û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>鿴<EFBFBD><EFBFBD>ͬѧ<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>Ϣ!<21><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD>!\n");break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
void student_xg()
|
|
|
|
|
{struct student stu;
|
|
|
|
|
char xh[50],s[100],buf[100][50];
|
|
|
|
|
memset(buf,0,sizeof(buf));
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>ͬѧѧ<EFBFBD>ţ<EFBFBD>\n");
|
|
|
|
|
scanf("%s",xh);int ok=0;
|
|
|
|
|
int cout,len=strlen(xh),i,p=0;
|
|
|
|
|
freopen("student.txt","r",stdin);
|
|
|
|
|
while(gets(s))
|
|
|
|
|
{cout=0;
|
|
|
|
|
for(i=0;i<strlen(xh);i++)
|
|
|
|
|
{
|
|
|
|
|
if(xh[i]==s[i])cout++;
|
|
|
|
|
}
|
|
|
|
|
if(cout==len){ok=1;break;}
|
|
|
|
|
}
|
|
|
|
|
freopen("CON","r",stdin);
|
|
|
|
|
freopen("CON","w",stdout);
|
|
|
|
|
if(ok)
|
|
|
|
|
{
|
|
|
|
|
char f[100];int op;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ѡ<EFBFBD><EFBFBD>:1.<2E><>ַ 2.<2E>绰 3.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&op);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>\n");
|
|
|
|
|
scanf("%s",f);
|
|
|
|
|
freopen("student.txt","r",stdin);
|
|
|
|
|
while(scanf("%s%s%s%s%s%s%s%s\n",stu.xuehao,stu.xingming,stu.nianling,stu.xingbie,stu.nianyue,stu.dizhi,stu.dianhua,stu.email)!=EOF)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(stu.xuehao,xh)==0)//<2F>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if(op==1)
|
|
|
|
|
{
|
|
|
|
|
strcpy(stu.dizhi,f);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(op==2)
|
|
|
|
|
{
|
|
|
|
|
strcpy(stu.dianhua,f);
|
|
|
|
|
}
|
|
|
|
|
else if(op==3)
|
|
|
|
|
{
|
|
|
|
|
strcpy(stu.email,f);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
strcat(buf[p],stu.xuehao);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.xingming);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.nianling);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.xingbie);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.nianyue);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.dizhi);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.dianhua);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.email);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
p++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strcat(buf[p],stu.xuehao);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.xingming);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.nianling);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.xingbie);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.nianyue);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.dizhi);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.dianhua);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
strcat(buf[p],stu.email);buf[p][strlen(buf[p])]=' ';
|
|
|
|
|
p++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
freopen("student.txt","w",stdout);
|
|
|
|
|
for(i=0;i<p;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\n",buf[i]);
|
|
|
|
|
}
|
|
|
|
|
freopen("CON","r",stdin);
|
|
|
|
|
freopen("CON","w",stdout);
|
|
|
|
|
}
|
|
|
|
|
else printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
void student_sc()
|
|
|
|
|
{
|
|
|
|
|
char s[100],a[100],b[300],buf[30][100];
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>\n");
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
memset(buf,0,sizeof(buf));
|
|
|
|
|
freopen("student.txt","r",stdin);
|
|
|
|
|
int i=0,j;
|
|
|
|
|
while(scanf("%s",a)!=EOF)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
gets(b);
|
|
|
|
|
if(strcmp(s,a)!=0)
|
|
|
|
|
{strcat(buf[i],a);
|
|
|
|
|
strcat(buf[i++],b);}
|
|
|
|
|
}
|
|
|
|
|
freopen("student.txt","w",stdout);
|
|
|
|
|
for(j=0;j<i;j++)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\n",buf[j]);
|
|
|
|
|
}
|
|
|
|
|
freopen("CON","r",stdin);
|
|
|
|
|
freopen("CON","w",stdout);
|
|
|
|
|
}
|