mirror of
https://github.com/yv1ing/Student-Information-Management-System.git
synced 2025-09-16 14:44:46 +08:00
finished work
This commit is contained in:
72
function_module/registered_module.c
Normal file
72
function_module/registered_module.c
Normal file
@@ -0,0 +1,72 @@
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "windows.h"
|
||||
#include "../heads/for_function_module.h"
|
||||
#include "../heads/users.h"
|
||||
|
||||
void registered_module() {
|
||||
re_registered:
|
||||
//ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
system("cls");
|
||||
fflush(stdin);
|
||||
printf("------------------------------ѧ<><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ϵͳ------------------------------\n\n");
|
||||
printf("-><3E><>ǰλ<C7B0>ã<EFBFBD>ע<EFBFBD><D7A2>\n\n");
|
||||
|
||||
char account[20];
|
||||
char password1[20];
|
||||
char password2[20];
|
||||
printf("-><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺ţ<CBBA>");
|
||||
fflush(stdin);
|
||||
scanf("%s",&account);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>
|
||||
struct user *head,*p,*q;
|
||||
head=(struct user *) malloc(sizeof(struct user));
|
||||
q=head;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><CBBA>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>
|
||||
FILE *fp;
|
||||
fp = fopen("../users/users.txt", "r");
|
||||
while (!feof(fp)){
|
||||
p=(struct user *)malloc(sizeof(struct user));
|
||||
fscanf(fp,"%s %s",&p->account,&p->password);
|
||||
q->next=p;
|
||||
q=p;
|
||||
}
|
||||
fclose(fp);
|
||||
p->next=NULL;
|
||||
|
||||
//<2F>ж<EFBFBD><D0B6>˺<EFBFBD><CBBA>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
p=head->next;
|
||||
while (p!=NULL){
|
||||
//<2F>˺Ŵ<CBBA><C5B4><EFBFBD>
|
||||
if(strcmp(account,p->account)==0){
|
||||
printf("<EFBFBD>˺<EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>뻻<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>˺ţ<EFBFBD>\n\n");
|
||||
Sleep(2000);
|
||||
goto re_registered;
|
||||
}
|
||||
p=p->next;
|
||||
}
|
||||
|
||||
//<2F>˺Ų<CBBA><C5B2><EFBFBD><EFBFBD><EFBFBD>
|
||||
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
||||
scanf("%s",&password1);
|
||||
printf("<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
||||
scanf("%s",&password2);
|
||||
|
||||
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>һ<EFBFBD><D2BB>
|
||||
if(strcmp(password1,password2)==0){
|
||||
FILE *fp;
|
||||
fp = fopen("../users/users.txt", "a");
|
||||
fprintf(fp,"%-20s %-20s",account,password1);
|
||||
fclose(fp);
|
||||
printf("ע<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
|
||||
Sleep(2000);
|
||||
main();
|
||||
}
|
||||
else{
|
||||
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻һ<EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>\n\n");
|
||||
Sleep(2000);
|
||||
goto re_registered;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user