最新C语言课程设计报告书教小学生学英语.doc
Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateC语言课程设计报告书教小学生学英语C语言程序设计C语言程序设计课程设计报告设计题目:教小学生学英语专 业 微电子 学 号 3130434063 班 级 132班 姓 名 布玛利亚.吾斯曼 指导教师 张老师 2013 年 秋季 学期 设计任务: 题目:计算机辅助教学(CAI)软件开发:教小学生学英语功能:1.屏幕上随机出现一个汉语单词,英语单词,汉语词组,英语词组或一短句提示小学生给出相应答案,答错了要提示要求重新输入,直到答对为止。要统计给分,且累计,够一定分数后可进级,即从单词到词组,从词组到短句。同样,也可降级。起步阶段可各选30个,软件可扩充,即扩大词库的容量。 (rand(),#include<stdio.h> 结构体、文件或数组) 2.保存:将相关数据写入磁盘文件,便于存、取操作。分步实施: 1、初步完成总体设计,搭好框架,确定人机对话的界面,确定函数个数; 2、完成最低要求:能教单词,并有统计功能,即一次答对的成功率为90%以上 后可晋级; 3、进一步要求:将词库、当前晋级等级保存在磁盘文件,每次登录时读取。要求:1、用C语言实现程序设计;2、利用结构体进行相关信息处理;3、系统的各个功能模块要求用函数的形式实现;4、界面友好(良好的人机交互),程序要有注释。平时成绩:验收答辩成绩:设计报告成绩:总评成绩:指导教师:一、总体设计1程序的总体设计 思考如何使用合理方法使使用者有效利用软件记住单词,将自己的想法通过程序来实现。2. 数据结构3. 函数原型声明二、详细设计1.main( )(流程图) 2源程序#include<stdio.h>#include<string.h>#include<time.h>#include<stdlib.h>#define SIZE 100/声明函数,结构void zero();/主显示界面void select();/选择界面void save();/保存界面函数void save1();/保存单词函数void save2();/保存短语函数void save3();/保存短句函数void see();/查看词库界面void see1();/查看单词词库void see2();/查看短语词库void see3();/查看短句词库void one();/学习单词函数void two();/学习短语函数void three();/学习短句函数struct word_list char a110;char b110;wordSIZE;struct phrase_list char a220; char b220;phraseSIZE;struct sentence_list char a3100; char b3100;sentenceSIZE;/定义函数void main()zero();select();void zero()printf("n"); printf("nnn"); printf("t| |n");printf("t| |n");printf("t| |n"); printf("t| -快-乐-学-习快-乐-成-长- |n");printf("t| |n");printf("t| love me, love English! |n");printf("t| |n");printf("t| |n"); printf("t| 1.开始学习 |n"); printf("t| |n"); printf("t| 2.扩大词库 |n"); printf("t| |n"); printf("t| 3.查看词库 |n");printf("t| |n"); printf("t| 4.退出系统 |n"); printf("t| |n");printf("t| |n");printf("t| |n");printf("t|n");void select() int a;printf("tt 请选择: ");scanf("%d",&a);switch(a) case 1:one();break; case 2:save();break; case 3:see();break;case 4:exit(0);default: printf("errorn");void save()int b;printf("n"); printf("n"); printf("tt|n"); printf("tt| |n"); printf("tt| -快-乐-学-习&&&快-乐-成-长- |n");printf("tt| |n");printf("tt| !love me, love english! |n");printf("tt| |n"); printf("tt| 1.记录单词 |n"); printf("tt| |n"); printf("tt| 2.记录词组 |n"); printf("tt| |n");printf("tt| 3.记录句子 |n"); printf("tt| |n"); printf("tt| 4.返回 |n");printf("tt| |n"); printf("tt|n");printf("tt 请输入: ");scanf("n %d",&b);switch(b) case 1:save1();break; case 2:save2();break;case 3:save3();break;case 4:zero(); select();break;default: printf("errorn");void save1()int i,j,m1;FILE *fp1,*fi1;if(fp1=fopen("word_list","r")=NULL)fp1=fopen("word_list","wb");fclose(fp1);if(fi1=fopen("c1","r")=NULL)m1=0;fi1=fopen("c1","wb");fwrite(&m1,sizeof(int),1,fi1);fclose(fi1);if(fi1=fopen("c1","rb")!=NULL)fi1=fopen("c1","rb");fread(&m1,sizeof(int),1,fi1);i=m1;for(i;i<=SIZE;i+)if(m1>=(SIZE-1)printf("n-已存满,不能存入数据-");break;elseprintf("请输入英文单词:");getchar();gets(wordi.a1);printf("n请输入中文词语:");gets(wordi.b1);if(fp1=fopen("word_list","ab")=NULL)printf("cannot open filen"); exit(0);if(fwrite(&wordi,sizeof(struct word_list),1,fp1)!=1)printf("file write errorn");fclose(fp1);m1=m1+1;if(fi1=fopen("c1","wb")=NULL)printf("cannot open filen"); exit(0);if(fwrite(&m1,sizeof(int),1,fi1)!=1)printf("file write errorn");fclose(fi1);printf("tt n");printf("tt n"); printf("tt|n"); printf("tt| |n"); printf("tt|-记录成功!是否继续记录单词-|n");printf("tt| |n"); printf("tt| |n");printf("tt| 1.继续- |n");printf("tt| |n"); printf("tt| 2.退出- |n");printf("tt| |n");printf("tt| |n"); printf("tt|n"); printf("tt 请输入: ");scanf("%d",&j);if(j=1) ;else if(j=2)break;zero();select();void save2()int i,j,m2;FILE *fp2,*fi2;if(fp2=fopen("phrase_list","r")=NULL)fp2=fopen("phrase_list","wb");fclose(fp2);if(fi2=fopen("c2","r")=NULL)m2=0;fi2=fopen("c2","wb");fwrite(&m2,sizeof(int),1,fi2);fclose(fi2);if(fi2=fopen("c2","rb")!=NULL)fi2=fopen("c2","rb");fread(&m2,sizeof(int),1,fi2);i=m2;for(i;i<=SIZE;i+)if(m2>=(SIZE-1)printf("n-已存满,不能存入数据-");break;elseprintf("请输入英文短语:");getchar();gets(phrasei.a2);printf("n请输入中文短语:");gets(phrasei.b2);if(fp2=fopen("phrase_list","ab")=NULL)printf("cannot open filen"); exit(0);if(fwrite(&phrasei,sizeof(struct phrase_list),1,fp2)!=1)printf("file write errorn");fclose(fp2);m2=m2+1;if(fi2=fopen("c2","wb")=NULL)printf("cannot open filen"); exit(0);if(fwrite(&m2,sizeof(int),1,fi2)!=1)printf("file write errorn");fclose(fi2);printf("tt n");printf("tt n"); printf("tt|n"); printf("tt| |n"); printf("tt|-记录成功!是否继续记录单词-|n");printf("tt| |n"); printf("tt| |n");printf("tt| 1.继续- |n");printf("tt| |n"); printf("tt| 2.退出- |n");printf("tt| |n");printf("tt| |n"); printf("tt|n"); printf("tt 请输入: ");scanf("%d",&j);if(j=1) ;else if(j=2)break;zero();select();void save3()int i,j,m3;FILE *fp3,*fi3;if(fp3=fopen("sentence_list","r")=NULL)fp3=fopen("sentence_list","wb");fclose(fp3);if(fi3=fopen("c3","r")=NULL)m3=0;fi3=fopen("c3","wb");fwrite(&m3,sizeof(int),1,fi3);fclose(fi3);if(fi3=fopen("c3","rb")!=NULL)fi3=fopen("c3","rb");fread(&m3,sizeof(int),1,fi3);i=m3;for(i;i<=SIZE;i+)if(m3>=(SIZE-1)printf("n-已存满,不能存入数据-");break;elseprintf("请输入英文短句:");getchar();gets(sentencei.a3);printf("n请输入中文短句:");gets(sentencei.b3);if(fp3=fopen("sentence_list","ab")=NULL)printf("cannot open filen"); exit(0);if(fwrite(&sentencei,sizeof(struct sentence_list),1,fp3)!=1)printf("file write errorn");fclose(fp3);m3=m3+1;if(fi3=fopen("c3","wb")=NULL)printf("cannot open filen"); exit(0);if(fwrite(&m3,sizeof(int),1,fi3)!=1)printf("file write errorn");fclose(fi3);printf("tt n");printf("tt n"); printf("tt|n"); printf("tt| |n"); printf("tt|-记录成功!是否继续记录单词-|n");printf("tt| |n"); printf("tt| |n");printf("tt| 1.继续- |n");printf("tt| |n"); printf("tt| 2.退出- |n");printf("tt| |n");printf("tt| |n"); printf("tt|n"); printf("tt 请输入: ");scanf("%d",&j);if(j=1) ;else if(j=2)break;zero();select();void see()int j;printf("tt n");printf("tt n"); printf("tt|n"); printf("tt| |n"); printf("tt|-请选择记忆类型-|n");printf("tt| |n");printf("tt| |n");printf("tt| 1.记忆单词 |n");printf("tt| |n"); printf("tt| 2.记忆短语 |n");printf("tt| |n");printf("tt| 3.记忆句子 |n");printf("tt| |n");printf("tt| 4.退出 |n");printf("tt| |n"); printf("tt|n"); printf("tt 请输入: ");scanf("%d",&j);if(j=1) see1();else if(j=2) see2();else if(j=3) see3();else if(j=4) zero();select();void see1()int i,m1;FILE *fp1,*fi1;if(fi1=fopen("c1","r")=NULL)printf("t-无存储信息-n");see();fi1=fopen("c1","rb");fread(&m1,sizeof(int),1,fi1);if(m1=0)printf("t-无存储信息-n");see();for(i=0;i<m1;i+)fp1=fopen("word_list","rb"); fseek(fp1,i*sizeof(struct word_list),0);fread(&wordi,sizeof(struct word_list),1,fp1);printf("英语:%snn中文:%sn",&wordi.a1,&wordi.b1);printf("*n");fclose(fp1);fclose(fi1);see();void see2()int i,m2;FILE *fp2,*fi2;if(fi2=fopen("c2","r")=NULL)printf("t-无存储信息-n");see();fi2=fopen("c2","rb");fread(&m2,sizeof(int),1,fi2);if(m2=0)printf("t-无存储信息-n");see();for(i=0;i<m2;i+)fp2=fopen("phrase_list","rb"); fseek(fp2,i*sizeof(struct phrase_list),0);fread(&phrasei,sizeof(struct phrase_list),1,fp2);printf("英语:%sn中文:%sn",&phrasei.a2,&phrasei.b2);printf("*n");fclose(fp2);fclose(fi2);see();void see3()int i,m3;FILE *fp3,*fi3;if(fi3=fopen("c3","r")=NULL)printf("t-无存储信息-n");see();fi3=fopen("c3","rb");fread(&m3,sizeof(int),1,fi3);if(m3=0)printf("t-无存储信息- -n");see();for(i=0;i<m3;i+)fp3=fopen("sentence_list","rb"); fseek(fp3,i*sizeof(struct sentence_list),0);fread(&sentencei,sizeof(struct sentence_list),1,fp3);printf("英语:%sn中文:%sn",&sentencei.a3,&sentencei.b3);printf("*n");fclose(fp3);fclose(fi3);see();void one()int m1,n,k,i,j=0,t;char a10;getchar();FILE *fi1,*fp1;if(fi1=fopen("c1","r")=NULL)printf("t-无学习信息-n");zero();select();fi1=fopen("c1","rb");fread(&m1,sizeof(int),1,fi1);n=m1;fclose(fi1);if(n<10)printf("nt-学习单词不够,请录入单词-n");zero();select();elseprintf("t单词练习n");srand(unsigned)time(NULL);for(i=0;i<5;i+)k=rand()%n+1;fp1=fopen("word_list","rb");fseek(fp1,(k-1)*sizeof(struct word_list),0);fread(&wordk-1,sizeof(struct word_list),1,fp1);printf("n%s 翻译为中文:",&wordk-1.a1);gets(a);if(strcmp(a,wordk-1.b1)=0)printf("n-回答正确!-n");j+;elseprintf("n-回答错误,加油,再试试吧-n");printf("n%s 翻译为中文:",&wordk-1.a1);gets(a);if(strcmp(a,wordk-1.b1)=0)printf("n-回答正确!-n");else printf("n-回答错误,记住下面的正确答案哦!-n");printf("正确答案: %sn",&wordk-1.b1);