|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <conio.h>
|
|
|
|
|
//#include <unistd.h>
|
|
|
|
|
void menus();
|
|
|
|
|
void input();
|
|
|
|
|
void display();
|
|
|
|
|
void save();
|
|
|
|
|
int my_delete();
|
|
|
|
|
void end();
|
|
|
|
|
int password();
|
|
|
|
|
int login();
|
|
|
|
|
int cpassword();
|
|
|
|
|
int alter();
|
|
|
|
|
void demand();
|
|
|
|
|
void _menus();
|
|
|
|
|
void out();
|
|
|
|
|
void _menus2();
|
|
|
|
|
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
|
|
|
|
|
|
|
|
|
|
int num=0;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>д洢<D0B4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
struct node{
|
|
|
|
|
char stnum[20];
|
|
|
|
|
char stname[20];
|
|
|
|
|
char sex[8];
|
|
|
|
|
int age;
|
|
|
|
|
char detail[100];
|
|
|
|
|
}student[1000];
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
|
|
|
|
|
|
if(!login())return 0;
|
|
|
|
|
menus();
|
|
|
|
|
char choice;
|
|
|
|
|
while(1){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷѡ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
choice=getch();
|
|
|
|
|
system("cls");
|
|
|
|
|
switch(choice){
|
|
|
|
|
case '1':
|
|
|
|
|
input();
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case '2':
|
|
|
|
|
display();
|
|
|
|
|
break;
|
|
|
|
|
case '3':
|
|
|
|
|
printf("\a<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>ϵͳ\n<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'Y'\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
char ch;
|
|
|
|
|
ch=getch();
|
|
|
|
|
if(ch=='Y'||ch=='y'){
|
|
|
|
|
save();
|
|
|
|
|
out();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '4':
|
|
|
|
|
if(my_delete()!=1){
|
|
|
|
|
out();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '5':
|
|
|
|
|
if(alter()!=1){
|
|
|
|
|
out();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '6':
|
|
|
|
|
demand();
|
|
|
|
|
break;
|
|
|
|
|
case '7':
|
|
|
|
|
if(cpassword()!=1){
|
|
|
|
|
out();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '8':
|
|
|
|
|
out();
|
|
|
|
|
return 0;
|
|
|
|
|
default:
|
|
|
|
|
system("cls");
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|
|
|
|
|
menus();
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void out()
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(int i=3;i>0;i--){
|
|
|
|
|
printf("%d<><64><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n",i);
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void menus()
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t\t**********<2A><>ѡ<EFBFBD><D1A1>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>**************\n");
|
|
|
|
|
printf("\t\t\t\t*--------1 ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>--------------*\n");
|
|
|
|
|
printf("\t\t\t\t*--------2 ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ʾ--------------*\n");
|
|
|
|
|
printf("\t\t\t\t*--------3 ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>--------------*\n");
|
|
|
|
|
printf("\t\t\t\t*---4 ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣɾ<CFA2><C9BE>(<28><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)-*\n");
|
|
|
|
|
printf("\t\t\t\t*---5 ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>(<28><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)-*\n");
|
|
|
|
|
printf("\t\t\t\t*--------6 ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ--------------*\n");
|
|
|
|
|
printf("\t\t\t\t*------------7 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>------------------*\n");
|
|
|
|
|
printf("\t\t\t\t*------------8 <20>˳<EFBFBD>ϵͳ------------------*\n");
|
|
|
|
|
printf("\t\t\t\t******************************************\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void input()
|
|
|
|
|
{
|
|
|
|
|
int n=0;
|
|
|
|
|
char c='0';
|
|
|
|
|
int falg=1;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
do{
|
|
|
|
|
c=getch();
|
|
|
|
|
if(c>'9'||c<'0'){
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ֵ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
}
|
|
|
|
|
}while(c>'9'||c<'0');
|
|
|
|
|
n=c-'0';
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>%d<><64>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>\n",n);
|
|
|
|
|
if(num+n+1>=1000){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>%d<><64>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>\n",1000-num-1);
|
|
|
|
|
falg=0;
|
|
|
|
|
}
|
|
|
|
|
for(int i=num;i<n+num;i++){
|
|
|
|
|
if(i==num)printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ע\n");
|
|
|
|
|
if(!falg){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>%d<><64>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>",1000-i-1);
|
|
|
|
|
scanf("%s %s %s %d %s",&student[i].stnum,&student[i].stname,&student[i].sex,&student[i].age,&student[i].detail);
|
|
|
|
|
}else{
|
|
|
|
|
scanf("%s %s %s %d %s",&student[i].stnum,&student[i].stname,&student[i].sex,&student[i].age,&student[i].detail);
|
|
|
|
|
}
|
|
|
|
|
if(i!=n+num-1)printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
if(!falg)num=1000;
|
|
|
|
|
else num+=n;
|
|
|
|
|
printf("¼<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\a\n");
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void display()
|
|
|
|
|
{
|
|
|
|
|
struct node tem[1000];
|
|
|
|
|
int i=0;
|
|
|
|
|
printf("<EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
FILE *fp=fopen("data.txt","r");
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%-12s<32><73><EFBFBD><EFBFBD>:%-8s\t<EFBFBD>Ա<EFBFBD>:%-4s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%-4d\t<EFBFBD><EFBFBD>ע:%-4s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
end();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void save()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("data.txt","a+");
|
|
|
|
|
if(fp==NULL){
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>\n");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
for(int i=0;i<num;i++){
|
|
|
|
|
fprintf(fp,"%s\t%s\t%s\t%d\t%s\n",student[i].stnum,student[i].stname,student[i].sex,student[i].age,student[i].detail);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>%d<><64>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>\a\n",num);
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
int c=fclose(fp);
|
|
|
|
|
if(c!=0){
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int my_delete()
|
|
|
|
|
{
|
|
|
|
|
display();
|
|
|
|
|
if(password()==0)return 0;
|
|
|
|
|
struct node tem[1000];
|
|
|
|
|
FILE *fp=fopen("data.txt","r");
|
|
|
|
|
FILE *out=fopen("data2.txt","w");
|
|
|
|
|
int i=0;
|
|
|
|
|
char s[20];
|
|
|
|
|
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>");
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
if(strcmp(s,tem[i].stnum)!=0)fprintf(out,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
fclose(out);
|
|
|
|
|
unlink("data.txt");
|
|
|
|
|
rename("data2.txt","data.txt");
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>\a");
|
|
|
|
|
Sleep(500);
|
|
|
|
|
system("cls");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int alter()
|
|
|
|
|
{
|
|
|
|
|
display();
|
|
|
|
|
if(password()==0)return 0;
|
|
|
|
|
struct node tem[1000];
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("data.txt","r");
|
|
|
|
|
FILE *ou;
|
|
|
|
|
ou=fopen("data2.txt","w");
|
|
|
|
|
int i=0;
|
|
|
|
|
char s[20];
|
|
|
|
|
char t[20];
|
|
|
|
|
int d;
|
|
|
|
|
printf("<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>");
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
system("cls");
|
|
|
|
|
_menus2();
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>\n");
|
|
|
|
|
char cho;
|
|
|
|
|
while(1){
|
|
|
|
|
cho=getch();
|
|
|
|
|
if(cho<'5'&&cho>'0')break;
|
|
|
|
|
else printf("<EFBFBD><EFBFBD>ֵ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%dѡ<64><D1A1>\n",cho-'0');
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>");
|
|
|
|
|
switch (cho){
|
|
|
|
|
case '1':
|
|
|
|
|
scanf("%s",t);
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
if(strcmp(s,tem[i].stnum)==0)
|
|
|
|
|
{
|
|
|
|
|
fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",t,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%-12s<32><73><EFBFBD><EFBFBD>:%-8s\t<EFBFBD>Ա<EFBFBD>:%-4s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%-4d\t<EFBFBD><EFBFBD>ע:%-4s\n",t,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
}
|
|
|
|
|
else fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '2':
|
|
|
|
|
scanf("%s",t);
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
if(strcmp(s,tem[i].stnum)==0)
|
|
|
|
|
{
|
|
|
|
|
fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,t,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%-12s<32><73><EFBFBD><EFBFBD>:%-8s\t<EFBFBD>Ա<EFBFBD>:%-4s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%-4d\t<EFBFBD><EFBFBD>ע:%-4s\n",tem[i].stnum,t,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
}
|
|
|
|
|
else fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '3':
|
|
|
|
|
scanf("%s",t);
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
if(strcmp(s,tem[i].stnum)==0)
|
|
|
|
|
{
|
|
|
|
|
fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,tem[i].stname,t,tem[i].age,tem[i].detail);
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%-12s<32><73><EFBFBD><EFBFBD>:%-8s\t<EFBFBD>Ա<EFBFBD>:%-4s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%-4d\t<EFBFBD><EFBFBD>ע:%-4s\n",tem[i].stnum,tem[i].stname,t,tem[i].age,tem[i].detail);
|
|
|
|
|
}
|
|
|
|
|
else fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '4':
|
|
|
|
|
scanf("%d",&d);
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
if(strcmp(s,tem[i].stnum)==0)
|
|
|
|
|
{
|
|
|
|
|
fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,d,tem[i].detail);
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%-12s<32><73><EFBFBD><EFBFBD>:%-8s\t<EFBFBD>Ա<EFBFBD>:%-4s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%-4d\t<EFBFBD><EFBFBD>ע:%-4s\n",tem[i].stnum,tem[i].stname,tem[i].sex,d,tem[i].detail);
|
|
|
|
|
}
|
|
|
|
|
else fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
out();
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
if(strcmp(s,tem[i].stnum)!=0)fprintf(ou,"%s\t%s\t%s\t%d\t%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
fclose(ou);
|
|
|
|
|
unlink("data.txt");
|
|
|
|
|
rename("data2.txt","data.txt");
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>\a");
|
|
|
|
|
Sleep(2500);
|
|
|
|
|
system("cls");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void demand()
|
|
|
|
|
{
|
|
|
|
|
char choice;
|
|
|
|
|
while(1){
|
|
|
|
|
while(1){
|
|
|
|
|
system("cls");
|
|
|
|
|
_menus();
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷѡ<EFBFBD>\n");
|
|
|
|
|
choice=getch();
|
|
|
|
|
if(choice<'6'&&choice>'0'){
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%dѡ<64><D1A1>\n",choice-'0');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
struct node tem[1000];
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("data.txt","r");
|
|
|
|
|
if(fp==NULL){
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>\n");
|
|
|
|
|
end();
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
int i=0;
|
|
|
|
|
while(fscanf(fp,"%s%s%s%d%s",tem[i].stnum,tem[i].stname,tem[i].sex,&tem[i].age,tem[i].detail)!=EOF){
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
int sum=i;
|
|
|
|
|
char d[20];
|
|
|
|
|
int c;
|
|
|
|
|
int fa=1;
|
|
|
|
|
switch(choice){
|
|
|
|
|
case '1':
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",d);
|
|
|
|
|
for(int i=0;i<sum;i++){
|
|
|
|
|
if(strcmp(d,tem[i].stnum)==0){
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\t<EFBFBD>Ա<EFBFBD>:%s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\t<EFBFBD><EFBFBD>ע:%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
fa=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("%s\a\n",fa==1?"<EFBFBD>˴β<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>":"<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>");
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case '2':
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",d);
|
|
|
|
|
for(int i=0;i<sum;i++){
|
|
|
|
|
if(strcmp(d,tem[i].stname)==0){
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\t<EFBFBD>Ա<EFBFBD>:%s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\t<EFBFBD><EFBFBD>ע:%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
fa=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("%s\a\n",fa==1?"<EFBFBD>˴β<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>":"<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>");
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case '3':
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>:");
|
|
|
|
|
scanf("%s",d);
|
|
|
|
|
for(int i=0;i<sum;i++){
|
|
|
|
|
if(strcmp(d,tem[i].sex)==0){
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\t<EFBFBD>Ա<EFBFBD>:%s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\t<EFBFBD><EFBFBD>ע:%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
fa=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("%s\a\n",fa==1?"<EFBFBD>˴β<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>":"<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>");
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&c);
|
|
|
|
|
for(int i=0;i<sum;i++){
|
|
|
|
|
if(c==tem[i].age){
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\t<EFBFBD>Ա<EFBFBD>:%s\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\t<EFBFBD><EFBFBD>ע:%s\n",tem[i].stnum,tem[i].stname,tem[i].sex,tem[i].age,tem[i].detail);
|
|
|
|
|
fa=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("%s\a\n",fa==1?"<EFBFBD>˴β<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>":"<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>");
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case '5':
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void end()
|
|
|
|
|
{
|
|
|
|
|
char c;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
c=getch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _menus()
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t\t\t********ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>IJ<EFBFBD>ѯ********\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------1 <20><>ѧ<EFBFBD>Ų<EFBFBD>ѯ----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------3 <20><><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ѯ----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------5 <20>˳<EFBFBD><CBB3><EFBFBD>ѯ------------*\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _menus2()
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t\t\t*********<2A><>ѡ<EFBFBD><D1A1><EFBFBD>ķ<DEB8>ʽ*******\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------1 <20><EFBFBD>ѧ<EFBFBD><D1A7>----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------2 <20><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------3 <20><EFBFBD><DEB8>Ա<EFBFBD>----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------4 <20><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>----------*\n");
|
|
|
|
|
printf("\t\t\t\t\t*--------5 <20>˳<EFBFBD>--------------*\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int password()
|
|
|
|
|
{
|
|
|
|
|
char mi[100];
|
|
|
|
|
char mi2[100];
|
|
|
|
|
char zhang2[100];
|
|
|
|
|
mi2[100]='\0';
|
|
|
|
|
mi[100]='\0';
|
|
|
|
|
int fa=1;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("user.txt","r");
|
|
|
|
|
if(fp==NULL){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
}
|
|
|
|
|
fscanf(fp,"%s",zhang2);
|
|
|
|
|
fscanf(fp,"%s",mi2);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
while(1){
|
|
|
|
|
if(fa>3){
|
|
|
|
|
char si;
|
|
|
|
|
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>");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>!\n");
|
|
|
|
|
si=getch();
|
|
|
|
|
if(si=='Y'||si=='y'){}else return 0;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
scanf("%s",mi);
|
|
|
|
|
if(strcmp(mi,mi2)==0){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
return 1;
|
|
|
|
|
}else {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
fa++;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
int login()
|
|
|
|
|
{
|
|
|
|
|
char mi[100];
|
|
|
|
|
char zhang[100];
|
|
|
|
|
char mi2[100];
|
|
|
|
|
char zhang2[100];
|
|
|
|
|
mi2[100]='\0';
|
|
|
|
|
mi[100]='\0';
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("user.txt","r");
|
|
|
|
|
if(fp==NULL){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
fscanf(fp,"%s",zhang2);
|
|
|
|
|
fscanf(fp,"%s",mi2);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
for(int i=0;i<3;i++){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺ţ<EFBFBD>");
|
|
|
|
|
scanf("%s",zhang);
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
scanf("%s",mi);
|
|
|
|
|
printf("\n");
|
|
|
|
|
if(strcmp(mi,mi2)!=0||strcmp(zhang,zhang2)!=0){
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD>˺Ż<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n<EFBFBD>㻹<EFBFBD><EFBFBD>%d<>λ<EFBFBD><CEBB><EFBFBD>\n",3-i-1);
|
|
|
|
|
if(3-i-1==0){
|
|
|
|
|
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>!\n");
|
|
|
|
|
getchar();
|
|
|
|
|
getchar();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ӭʹ<EFBFBD>ñ<EFBFBD>ϵͳ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
end();
|
|
|
|
|
system("cls");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int cpassword()
|
|
|
|
|
{
|
|
|
|
|
char mi[100];
|
|
|
|
|
char zhang[100];
|
|
|
|
|
char mi2[100];
|
|
|
|
|
mi2[100]='\0';
|
|
|
|
|
mi[100]='\0';
|
|
|
|
|
char zhang2[100];
|
|
|
|
|
if(password()!=1){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
FILE *out;
|
|
|
|
|
out=fopen("user.txt","r");
|
|
|
|
|
fscanf(out,"%s",zhang2);
|
|
|
|
|
fclose(out);
|
|
|
|
|
while(1){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
scanf("%s",mi2);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
scanf("%s",mi);
|
|
|
|
|
if(strcmp(mi,mi2)==0){
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("user.txt","w+");
|
|
|
|
|
fprintf(fp,"%s %s",zhang2,mi2);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
break;
|
|
|
|
|
}else {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻ƥ<EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
system("cls");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ijɹ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>½<EFBFBD><EFBFBD>\n");
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
system("cls");
|
|
|
|
|
return login();
|
|
|
|
|
}
|