|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <conio.h>
|
|
|
|
|
//#include <unistd.h>
|
|
|
|
|
#include "head.h"
|
|
|
|
|
|
|
|
|
|
/* 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'){
|
|
|
|
|
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'){
|
|
|
|
|
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");
|
|
|
|
|
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>");
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
system("cls");
|
|
|
|
|
_menus2();
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>\n");
|
|
|
|
|
char cho;
|
|
|
|
|
cho=getch();
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
int choice;
|
|
|
|
|
while(1){
|
|
|
|
|
while(1){
|
|
|
|
|
system("cls");
|
|
|
|
|
_menus();
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷѡ<EFBFBD>\n");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
if(choice<6&&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);
|
|
|
|
|
printf("\n");
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",d);
|
|
|
|
|
printf("\n");
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>:");
|
|
|
|
|
scanf("%s",d);
|
|
|
|
|
printf("\n");
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&c);
|
|
|
|
|
printf("\n");
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
if(fa==0)printf("<EFBFBD>˴β<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\a\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void end()
|
|
|
|
|
{
|
|
|
|
|
char c;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
c=getch();
|
|
|
|
|
}
|
|
|
|
|
int cpassword()
|
|
|
|
|
{
|
|
|
|
|
char mi[100];
|
|
|
|
|
char zhang[100];
|
|
|
|
|
char mi2[100];
|
|
|
|
|
char zhang2[100];
|
|
|
|
|
if(password()!=1){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
FILE *out;
|
|
|
|
|
out=fopen("user.txt","r");
|
|
|
|
|
fscanf(out,"%s",zhang2);
|
|
|
|
|
fclose(out);
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("user.txt","w+");
|
|
|
|
|
if(fp==NULL){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
}
|
|
|
|
|
do{
|
|
|
|
|
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)){
|
|
|
|
|
fseek(fp,0L,SEEK_SET);
|
|
|
|
|
fprintf(fp,"%s %s",zhang2,mi2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻ƥ<EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
}while(strcmp(mi,mi2)==0);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ijɹ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>½<EFBFBD><EFBFBD>\n");
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
system("cls");
|
|
|
|
|
return login();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int login()
|
|
|
|
|
{
|
|
|
|
|
char mi[100];
|
|
|
|
|
char zhang[100];
|
|
|
|
|
char mi2[100];
|
|
|
|
|
char zhang2[100];
|
|
|
|
|
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);
|
|
|
|
|
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>룺");
|
|
|
|
|
// int k=0;
|
|
|
|
|
// for(k=0;k<100;k++){
|
|
|
|
|
// mi[k]=getch();
|
|
|
|
|
// if(mi[k]=='\r'){
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// printf("*");
|
|
|
|
|
// }
|
|
|
|
|
// mi[k]='\0';
|
|
|
|
|
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 password()
|
|
|
|
|
{
|
|
|
|
|
char mi[100];
|
|
|
|
|
char mi2[100];
|
|
|
|
|
char zhang2[100];
|
|
|
|
|
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==1)printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
else printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
scanf("%s",mi);
|
|
|
|
|
printf("%s\n",mi);
|
|
|
|
|
getchar();
|
|
|
|
|
if(fa>3){
|
|
|
|
|
char ch;
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룿\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
if(ch=='Y')return 0;
|
|
|
|
|
}
|
|
|
|
|
fa++;
|
|
|
|
|
if(strcmp(mi,mi2)==0){
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|