master
mao15987 6 years ago
parent 8e05eb4bfc
commit c8af09d2e0

@ -0,0 +1,9 @@
//存单词记录本
void WORD_CO(struct w_word *inpu) {
FILE *fp6;
fp6 = fopen("word_coll.txt", "a");
fwrite(inpu,sizeof(struct w_word),1, fp6);
fclose(fp6);
return;
}

35
2.cpp

@ -0,0 +1,35 @@
//鞫刻데늦션쩌굶
void FWORD_CO() {
system("cls");
int num=1;
printf("\t*****************************************\n");
color(5);
printf("\t* 데늦션쩌굶 *\n");
color(16);
printf("\t*****************************************\n");
color(6);
struct w_word *fword=(struct w_word *)malloc(sizeof(struct w_word));
char input[50];
FILE *fp7;
fp7 = fopen("word_coll.txt", "r");
if (fp7 == NULL) {
color(4);
printf("\t* 데늉션쩌굶轟데늦 *\n");
color(16);
system("pause");
return;
}
while (!feof(fp7)) {
if(fread(fword, sizeof(struct w_word), 1, fp7) != NULL && input[0] != '\0') {
printf("**************%d**************\n", num);
printf("\t");
puts(fword->word_);
printf("\t");
puts(fword->trans_);
num++;
}
}
printf("\t**************쀼났숩럿쀼*****************\n");
system("pause");
return;
}

@ -0,0 +1,8 @@
//´æ²éѯ¼Ç¼
void QUE(struct w_word *input) {
FILE *fps;
fps = fopen("query log.txt", "a");
fwrite(input,sizeof(struct w_word),1,fps);
fclose(fps);
return;
}

24
4.cpp

@ -0,0 +1,24 @@
//ÏÔʾ²éѯ¼Ç¼
void FQUE() {
int n=1;
system("cls");
printf("\t*****************************************\n");
printf("\t* ²éѯ¼Ç¼ *\n");
printf("\t*****************************************\n");
struct w_word *fque = (struct w_word *)malloc(sizeof(struct w_word));
FILE *fp7;
fp7 = fopen("query log.txt", "r");
while (!feof(fp7)) {
if(fread(fque, sizeof(struct w_word), 1,fp7) != NULL) {
printf("********%d********\n", n);
n++;
printf("\t");
puts(fque->word_);
printf("\t");
puts(fque->trans_);
}
}
printf("\t**************»Ø³µ¼ü·µ»Ø*****************\n");
system("pause");
return;
}

65
5.cpp

@ -0,0 +1,65 @@
//删除单词
void DETL() {
int nu = 0,i=0;
system("cls");
VIEW();
if (fnum == 0) {
printf("\t\t****************************\n");
printf("\t\t* 请输入要删除的单词 *\n");
printf("\t\t****************************\n");
int m1=-1,qu=0,x=0;
char a[100];
scanf("%s", a);
struct w_word ap[100];
FILE *fp = fopen("wordd.txt", "r");
while (!feof(fp)) {
if (fread(&ap[i], sizeof(struct w_word), 1, fp) != NULL) {
i++;
}
}
fclose(fp);
if (i == 0) {
printf("\t\t* 无单词 *");
system("pause");
return;
}
for (int m = 0; m < i; m++) {
if (strcmp(ap[m].word_,a) == 0) {
m1 = m;
break;
}
}
if (m1 == -1) {
printf("\t\t* 无对应单词 *\n");
system("pause");
qu = 1;
}
else {
for (int s = m1; s < i; s++) {
ap[s] = ap[s + 1];
}
i--;
if ((fp = fopen("wordd.txt", "w")) == NULL) {
return;
}
for (int k = 0; k < i; k++) {
if (fwrite(&ap[k], sizeof(struct w_word), 1, fp) != 1) {
printf("* 删除失败 *\n");
system("pause");
x = 1;
}
}
fclose(fp);
//printf("* 删除成功 *");
}
if (x == 0&&qu==0) {
printf("\t* 删除成功 *\n");
printf("\t* 回车进入下一步 *\n");
system("pause");
}
return;
}
return;
}
Loading…
Cancel
Save