From 17c3a88c2ef81a10d5d5a67d63bf437564065d19 Mon Sep 17 00:00:00 2001 From: p9jqm43at <2675985149@qq.com> Date: Sun, 15 Dec 2024 22:57:11 +0800 Subject: [PATCH] ADD file via upload --- wordmemorize.h | 505 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 505 insertions(+) create mode 100644 wordmemorize.h diff --git a/wordmemorize.h b/wordmemorize.h new file mode 100644 index 0000000..a1f226d --- /dev/null +++ b/wordmemorize.h @@ -0,0 +1,505 @@ +#include +#include +#include +#include +#define MAX_words 200 +typedef struct{ + char English[20]; + char Chinese[20]; +}Word;//结构体储存单词 +Word words[MAX_words];//结构体数组名,可调用 +int wordCount=0;//记录初始化的单词数 +void initWords(){ //初始化函数 + const char* p[100][2]={ + {"alarm", "警报"}, + {"aircraft", "飞机"}, + {"air", "空气"}, + {"aim", "目标"}, + {"aid", "帮助"}, + {"ahead", "在前"}, + {"agriculture", "农业"}, + {"agreement", "协议"}, + {"agree", "同意"}, + {"ago", "前"}, + {"aggressive", "侵略的"}, + {"agent", "代理人"}, + {"agenda", "议程"}, + {"agency", "代理"}, + {"age", "年龄"}, + {"against", "反对"}, + {"again", "再次"}, + {"afterword", "之后"}, + {"afternoon", "下午"}, + {"after", "在...之后"}, + {"afraid", "害怕"}, + {"afford", "负担得起"}, + {"affiliate", "使隶属"}, + {"affect", "感情"}, + {"affection", "影响"}, + {"affair", "事情"}, + {"aesthetic", "美学的"}, + {"aeroplane", "飞机"}, + {"advice", "建议"}, + {"advise", "建议"}, + {"advertisement", "广告"}, + {"advertise", "做广告"}, + {"adventurous", "冒险的"}, + {"adventure", "冒险"}, + {"advantage", "优势"}, + {"advanced", "高级的"}, + {"advance", "前进"}, + {"adult", "成年人"}, + {"adore", "崇拜"}, + {"adopt", "收养"}, + {"adolescent", "青少年"}, + {"admit", "承认"}, + {"admission", "入场费"}, + {"admire", "钦佩"}, + {"administrator", "管理员"}, + {"administration", "管理"}, + {"administer", "管理"}, + {"adjustment", "调整"}, + {"adjust", "调整"}, + {"adequate", "足够的"}, + {"address", "地址"}, + {"addtional", "附加的"}, + {"addtion", "加法"}, + {"addict", "使上瘾"}, + {"add", "添加"}, + {"adapt", "适应"}, + {"acute", "尖锐的"}, + {"actual", "实际的"}, + {"actress", "女演员"}, + {"actor", "演员"}, + {"activity", "活动"}, + {"activist", "活动家"}, + {"active", "积极的"}, + {"orange", "橙子"}, + {"act", "行动"}, + {"across", "横过"}, + {"acrobat", "杂技演员"}, + {"acquire", "获得"}, + {"acquaint", "使了解"}, + {"acknowledge", "承认"}, + {"achievement", "成就"}, + {"accustom", "使习惯"}, + {"achieve", "实现"}, + {"ache", "疼痛"}, + {"accumulate", "积累"}, + {"any", "任何"}, + {"abroad", "国外"}, + {"abrupt", "突然的"}, + {"absence", "缺席"}, + {"absorb", "吸收"}, + {"abstract", "抽象的"}, + {"absurd", "荒谬的"}, + {"abundance", "丰富"}, + {"abundant", "丰富的"}, + {"abuse", "滥用"}, + {"academic", "学术的"}, + {"academy", "学院"}, + {"accelerate", "加速"}, + {"accent", "口音"}, + {"accept", "接受"}, + {"accident", "意外"}, + {"accompany", "陪伴"}, + {"accomplish", "完成"}, + {"accord", "使一致"}, + {"accordance", "一致"}, + {"according", "根据"}, + {"ambition", "雄心"}, + {"amuse", "娱乐"}, + {"ancestor", "祖先"}, + {"ancient", "古代的"} + }; + int i; + for(i=0;i<100;i++){ + strcpy(words[i].English,p[i][0]); //将单词存入结构体数组 + strcpy(words[i].Chinese,p[i][1]); //将中文存入结构体数组 + wordCount++; + } +} +void praise(){ + int k; + srand(time(NULL)); + k=rand()%5+1; + switch(k){ + case 1:printf("Good job!\n"); + break; + case 2:printf("Well done!\n"); + break; + case 3:printf("Way to go!\n"); + break; + case 4:printf("Perfect!\n"); + break; + case 5:printf("Great!\n"); + } +} +int settingNumber(){ + int number; + printf("请选择你想背单词的个数(1到100)\n"); + scanf("%d",&number); + return number; + +} +void wordsentery(){ + printf("请输入你想要添加的单词:"); + scanf("%s",words[wordCount].English); + printf("请输入它的中文意思:"); + scanf("%s",words[wordCount].Chinese); + wordCount++; + system("pause"); + system("cls"); +} +int menu(){ + int select; + printf("************************************\n"); + printf("*********欢迎使用背单词系统*********\n"); + printf("************************************\n"); + printf("****\t[1]普通背单词 ****\n"); + printf("****\t[2]查看往次背诵成绩 ****\n"); + printf("****\t[3]趣味背单词 ****\n"); + printf("****\t[0]退出程序 ****\n"); + printf("************************************\n"); + printf("请输入选项>"); + scanf("%d",&select); + return select; +} +typedef struct grade{ + time_t stim; + int socer; +}grade; +typedef struct node{ + grade date; + struct node*next; +}Node; +typedef struct List{ + Node* front; + int size; +}List; +void entryRecord(List*list,int sc){ + Node *node =(Node*)malloc(sizeof(Node)); + if(!node){ + printf("malloc failed\n"); + } + node->next=NULL; + time(&node->date.stim); + node->date.socer=sc; + if(list->front==NULL){ + list->front=node; + }else{ + Node*lastNode; + lastNode=list->front; + while(lastNode->next!=NULL){ + lastNode=lastNode->next; + } + lastNode->next=node; + } + +} +void saveRecord(List*list){ + FILE*fp=fopen("record.txt","a"); + if(!fp){ + perror("file open failed"); + return; + } + Node*movenode=list->front; + while(movenode!=NULL){ + fprintf(fp,"时间:%s 成绩:%d\n",ctime(&movenode->date.stim),movenode->date.socer); + movenode=movenode->next; + } + +} + + +void readAndPrintFile(const char *filename) { + FILE *fp; + char ch; + + fp = fopen(filename, "r"); + if (fp == NULL) { + printf("无法打开文件: %s\n", filename); + return; + } + + while ((ch = fgetc(fp))!= EOF) { + putchar(ch); + } + + fclose(fp); +} +void BaiWords(Word words[],List*list){ + int score,n,m;float cnt; + srand(time(NULL)); + printf("请选择类型:1 给中输英 2 给英输中\n"); + scanf("%d",&m); + switch(m){ + case 1 : + score=0;cnt=0; + printf("请选择你的答题数量\n"); + do{ + scanf("%d",&n); + if(n<0||n>100)printf("输入范围错误,请重新输入!"); + }while(n<0||n>100); + for(int i=0;i100)printf("输入范围错误,请重新输入!"); + }while(n<0||n>100); + for(int i=0;i