master
子烨 梅 6 years ago
parent 8b3c382687
commit 8e05eb4bfc

Binary file not shown.

@ -27,14 +27,9 @@ void REGISTCOM() { //
struct userna_pw *regi1=(struct userna_pw*)malloc(sizeof(struct userna_pw)); struct userna_pw *regi1=(struct userna_pw*)malloc(sizeof(struct userna_pw));
FILE *fp; FILE *fp;
fp = fopen("username_pwCOM.txt", "a+"); //******************* //将用户名用结构数组存入文件 fp = fopen("username_pwCOM.txt", "a+"); //******************* //将用户名用结构数组存入文件
//memset(regi1->name1, 0, 101 * sizeof(char));
//memset(regi1->passd1, 0, 101 * sizeof(char));
//memset(regi1->passd2, 0, 101 * sizeof(char));
printf("\t*************************\n"); printf("\t*************************\n");
printf("\t* 请输入你的用户名 *\n"); printf("\t* 请输入你的用户名 *\n");
gets_s(regi1->name1); gets_s(regi1->name1);
//na0 = &uni0;
//pw0 = na0;
while (1) { while (1) {
printf("\t* 请输入你的密码 *\n"); printf("\t* 请输入你的密码 *\n");
gets_s(regi1->passd1); //将密码用相同结构数组存入文件 gets_s(regi1->passd1); //将密码用相同结构数组存入文件
@ -46,13 +41,7 @@ void REGISTCOM() { //
printf("\t* 请重新输入 *\n"); printf("\t* 请重新输入 *\n");
} }
else { else {
//strcpy(regi_n->name, regi1.name1);
//strcpy(regi_p->pw, regi1.passd1);
fwrite(regi1,sizeof(struct userna_pw),1 ,fp); fwrite(regi1,sizeof(struct userna_pw),1 ,fp);
//fputs("\n", fp);
//fputs(regi1.passd1, fp);
//fputs("\n", fp);
printf("*注册成功*\n"); printf("*注册成功*\n");
system("pause"); system("pause");
fclose(fp); fclose(fp);
@ -251,24 +240,10 @@ void PRINTF1_1()
if (strstr(chec->word_, tempor) !=NULL) { if (strstr(chec->word_, tempor) !=NULL) {
printf("\n"); printf("\n");
printf("%s", chec->word_); printf("%s", chec->word_);
//fread(strstr(((struct w_word *)check)->trans_, tempor), sizeof(struct w_word), 20, fp);
//puts(check->trans_);
//printf("\n");
//printf("例句.\t");
//fwrite(((struct w_word *)check)->setence, sizeof(struct w_word),20, fp);
//puts(check->setence);
printf("\n"); printf("\n");
//x = 1;
//break;
//system("pause");
} }
} }
rewind(fp); rewind(fp);
//fclose(fp);
//printf("\t* 回车健进行下一步 \n");
//system("pause");
//FILE *fpp;
//fpp = fopen("wordd.txt", "r");
while (fread(check, sizeof(struct w_word),1, fp) != NULL) { while (fread(check, sizeof(struct w_word),1, fp) != NULL) {
if (strstr(check->word_, tempor) == (char *)(check->word_)) { if (strstr(check->word_, tempor) == (char *)(check->word_)) {
printf("\n"); printf("\n");
@ -282,11 +257,8 @@ void PRINTF1_1()
printf("\n"); printf("\n");
x = 1; x = 1;
break; break;
//system("pause");
} }
} }
//system("pause");
//printf("\t* 回车健进行下一步 \n");
system("pause"); system("pause");
if(x==0) { if(x==0) {
@ -492,19 +464,12 @@ void IMPORT() { //
printf("\n"); printf("\n");
printf("\t* 请输入单词 *\n"); printf("\t* 请输入单词 *\n");
scanf("%s",&(tr + i)->word_); scanf("%s",&(tr + i)->word_);
//(tr + i)->word_[strlen((tr + i)->word_) ]='\0';
//fputs((wd+i)->word_, fp2);
//fputs(" ", fp2);
printf("\t* 请输入前面单词的翻译 *\n"); printf("\t* 请输入前面单词的翻译 *\n");
scanf("%s", &(tr + i)->trans_); scanf("%s", &(tr + i)->trans_);
getchar(); getchar();
//fputs((tr + i)->trans_, fp2);
//fputs("\n", fp2);
printf("\n"); printf("\n");
printf("\t* 请输入前面单词的例句 *\n"); printf("\t* 请输入前面单词的例句 *\n");
gets_s((tr+ i)->setence); gets_s((tr+ i)->setence);
//fputs((wd + i)->setence, fp2);
//fputs("\n", fp2);
rewind(fp2); rewind(fp2);
while (feof(fp2) != EOF) { while (feof(fp2) != EOF) {
while (fread(wd, sizeof(struct w_word), 1, fp2) != NULL) { while (fread(wd, sizeof(struct w_word), 1, fp2) != NULL) {
@ -521,7 +486,6 @@ void IMPORT() { //
fwrite((tr+i),sizeof(struct w_word),1,fp2); fwrite((tr+i),sizeof(struct w_word),1,fp2);
printf("\n"); printf("\n");
} }
//rewind(fp2);
fclose(fp2); fclose(fp2);
return; return;
@ -551,7 +515,7 @@ void VIEW() { //
} }
//查看和管理用户 //查看和管理用户
void LOANDMA() { void LOANDMA() {
int x = 0; int x = 0,at=0;
struct userna_pw *usp=(struct userna_pw*)malloc(sizeof(struct userna_pw)); struct userna_pw *usp=(struct userna_pw*)malloc(sizeof(struct userna_pw));
char number[100]; char number[100];
//char n[20]; //char n[20];
@ -564,30 +528,30 @@ void LOANDMA() {
return; return;
} }
else { else {
while (feof(fp5) != EOF) { while (!feof(fp5)) {
while (fread(usp,sizeof(struct userna_pw),1,fp5) != NULL) { if(fread(usp,sizeof(struct userna_pw),1,fp5) != NULL) {
printf("****用户名:"); printf("****用户名:");
puts(usp->name1); puts(usp->name1);
printf("****密码:"); printf("****密码:");
puts(usp->passd1); puts(usp->passd1);
at = 1;
} }
break;
} }
} }
//fflush(fp5);
fclose(fp5); fclose(fp5);
system("pause"); //system("pause");
if (at == 1) {
printf("\t* 是否选择删除用户 *\n"); printf("\t* 是否选择删除用户 *\n");
printf("\t* 1.是 2.否 *\n"); printf("\t* 1.是 2.否 *\n");
char keyy = getch(); char keyy = getch();
if (keyy == '1') { if (keyy == '1') {
FILE *fpp; FILE *fpp;
fpp = fopen("username_pwCOM.txt","r"); fpp = fopen("username_pwCOM.txt", "r");
rewind(fpp); rewind(fpp);
//struct userna_pw asd; //struct userna_pw asd;
struct userna_pw us[105]; struct userna_pw us[105];
int i=0,m1=(-1),qu=0; int i = 0, m1 = (-1), qu = 0;
while (1) { while (1) {
printf("\t* 请输入用户的用户名 *\n"); printf("\t* 请输入用户的用户名 *\n");
scanf("%s", number); scanf("%s", number);
@ -615,7 +579,7 @@ void LOANDMA() {
break; break;
} }
} }
if(m1==-1){ if (m1 == -1) {
printf("* 用户不存在 *"); printf("* 用户不存在 *");
qu = 1; qu = 1;
@ -645,10 +609,12 @@ void LOANDMA() {
return; return;
} }
}
else { else {
return; printf("\t************-ÎÞÓû§-**************\n");
system("pause");
} }
return;
} }
//存单词记录本 //存单词记录本
void WORD_CO(struct w_word *inpu) { void WORD_CO(struct w_word *inpu) {
@ -666,14 +632,6 @@ void FWORD_CO() {
printf("\t* 单词记录本 *\n"); printf("\t* 单词记录本 *\n");
printf("\t*****************************************\n"); printf("\t*****************************************\n");
struct w_word *fword=(struct w_word *)malloc(sizeof(struct w_word)); struct w_word *fword=(struct w_word *)malloc(sizeof(struct w_word));
//struct word_coll {
// char word1[100];
// char trans1[200];
// struct word_coll *next;
// int a;
//};
//struct word_coll *head = NULL;
//struct word_coll *prev=NULL, *current;
char input[50]; char input[50];
FILE *fp7; FILE *fp7;
fp7 = fopen("word_coll.txt", "r"); fp7 = fopen("word_coll.txt", "r");
@ -682,18 +640,12 @@ void FWORD_CO() {
system("pause"); system("pause");
return; return;
} }
while (feof(fp7) != EOF) { while (!feof(fp7)) {
while (fread(fword, sizeof(struct w_word), 1, fp7) != NULL && input[0] != '\0') { if(fread(fword, sizeof(struct w_word), 1, fp7) != NULL && input[0] != '\0') {
//current = (struct word_coll*)malloc(sizeof(struct word_coll)); printf("\t");
//if (head == NULL)
// head = current;
//else
//prev->next = current;
//current->next = NULL;
puts(fword->word_); puts(fword->word_);
printf("\t");
puts(fword->trans_); puts(fword->trans_);
//prev = current;
//memset(input, 0, sizeof(char) * 50);
} }
} }
printf("\t**************回车键返回*****************\n"); printf("\t**************回车键返回*****************\n");
@ -710,39 +662,26 @@ void QUE(struct w_word *input) {
} }
//显示查询记录 //显示查询记录
void FQUE() { void FQUE() {
int n=1;
system("cls"); system("cls");
printf("\t*****************************************\n"); printf("\t*****************************************\n");
printf("\t* 查询记录 *\n"); printf("\t* 查询记录 *\n");
printf("\t*****************************************\n"); printf("\t*****************************************\n");
struct w_word *fque = (struct w_word *)malloc(sizeof(struct w_word)); struct w_word *fque = (struct w_word *)malloc(sizeof(struct w_word));
//struct query_l {
// char word2[100];
// char trans2[200];
// struct query_l *next;
// int a;
//};
//struct query_l *head = NULL;
//struct query_l *prev=NULL , *current;
//char inputt[50];
FILE *fp7; FILE *fp7;
fp7 = fopen("query log.txt", "r"); fp7 = fopen("query log.txt", "r");
while (feof(fp7) != EOF) { while (!feof(fp7)) {
while (fread(fque, sizeof(struct w_word), 1,fp7) != NULL) { if(fread(fque, sizeof(struct w_word), 1,fp7) != NULL) {
//current = (struct query_l*)malloc(sizeof(struct query_l)); printf("********%d********\n", n);
//if (head == NULL) n++;
// head = current; printf("\t");
//else
// prev->next = current;
//current->next = NULL;
puts(fque->word_); puts(fque->word_);
printf("\t");
puts(fque->trans_); puts(fque->trans_);
//prev = current;
//memset(inputt, 0, sizeof(char) * 50);
} }
} }
printf("\t**************回车键返回*****************\n"); printf("\t**************回车键返回*****************\n");
while (getchar() != '\n') system("pause");
continue;
return; return;
} }
//排序并显示单词表 //排序并显示单词表
Loading…
Cancel
Save