单词本考试系统(c语言版).doc
《单词本考试系统(c语言版).doc》由会员分享,可在线阅读,更多相关《单词本考试系统(c语言版).doc(8页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、 单词管理考试系统(链表、结构体、文本读取与保存)注意:请使用的同学替换程序中本人的姓名! 本程序仅供大家参考,亦可应付大学作业检查,谢谢 -陆鑫使用到的函数及其功能说明:(1)void initial(SLNode * head);初始化链表,从文本读取数据并且添加到链表。(2)void printallwords(SLNode * head);遍历链表并且打印。(3)void addnewwords(SLNode * head);添加新单词到链表并且写入到文本。(4)void deleteoldwords(SLNode * head)从链表中删除指定元素,并从文本中删除。(5)void e
2、nglishtest(SLNode * head)根据中文翻译英文测试,最后能计算出结果及正确率。(6)void chinesetest(SLNode * head)根据英文翻译中文测试,最后能计算出结果及正确率。(7)void rewrite(SLNode * head)在对文本进行修改时,通过调用此函数实现对文本的修改。2、源代码recite.c#include#include#include#includerecite.hvoid main()SLNode * head=NULL;int choice;init(&head);printf(+-欢迎使用-+n|n|n);printf(|t
3、 1.浏览全部单词 2.添加新单词3.删除已存在单词n);printf(|t 4.英文测试 5.中文测试6.退出程序n);printf(|ttttttt 制作者:陆鑫n);printf(|n+-欢迎使用-+nnn);while(1)scanf(%d,&choice);switch (choice)case 1:printallwords(head);break;case 2:addnewwords(head);break;case 3:deleteoldwords(head);break;case 4:englishtest(head);break;case 5:chinesetest(hea
4、d);break;case 6:exit6();return; break;default:printf(输入错误!n);break;printf(nt |n);printf(t | 1.浏览全部单词 2.添加新单词 3.删除已存在单词 |n);printf(t | 4.英文测试 5.中文测试 6.退出程序 |n);printf(t n);recite.htypedef struct nodechar english20;char chinese20;struct node * next;SLNode;int count=0;int flag=0;void rewrite(SLNode * h
5、ead)FILE * fp;SLNode * L=head;if (fp=fopen(English_vocabulary.txt,w)=NULL)putchar(7);printf(文件打开失败!n);exit(0);L=L-next-next;while(L!=NULL)fputs(L-english,fp);fputc(n,fp);fputs(L-chinese,fp);fputc(n,fp);L=L-next;void init (SLNode * head)FILE * fp;double nr_word=1,nr_explain=1;SLNode * L;(*head)=(SLNo
6、de*)malloc(sizeof(SLNode);(*head)-next=NULL;if (fp=fopen(English_vocabulary.txt,a+)=NULL)putchar(7);printf(文件打开失败!n);exit(0);while (nr_word0&nr_explain0)L=(SLNode*)malloc(sizeof(SLNode);nr_word=fscanf(fp,%s,&(L-english);nr_explain=fscanf(fp,%s,&(L-chinese);L-next=(*head)-next;(*head)-next=L;count+;i
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 单词 考试 系统 语言版
限制150内