1、 目录目录 1. 问题描述问题描述-2 2. 具体要求具体要求-2 3. 测试数据测试数据-2 4. 算法思想算法思想-2 5. 模块划分模块划分-3 6. 数据结构数据结构-3 7. 源程序源程序-4 8. 测试情况测试情况-14 9. 设计总结设计总结-16 10. 参考文献参考文献-17 课程设计报告课程设计报告 1、 问题描述问题描述 找到一个文档中的回文单词并输出。 回文单词就是从左读到右和 从右读到左是一样的,如:did、txt、eye 等,其中文档中的内容有字 母、数字和标点符号,回文单词的判断是不包含标点符号的 ,但文 件输入流读取的时候标点也被一起读取进来了, 因此要删除字符
2、串中 的标点符号, 单独对每个单词进行判断。 栈是一种先进后出的线性表, 而队列是一种先进先出的线性表, 因此可利用栈和队列的这两个性质 对一个单词是否为回文单词进行检测,如果是则输出这个单词即可。 2、 基本要基本要求求 此课程设计要编写程序以实现检测出文档中的回文单词并将其 输出的功能,首先要将每一个单词读取出来,其次对每一个单词进行 回文判断,主程序用栈和队列实现,以进一步巩固、理解和运用本学 期所学知识;同时要利用到文件输入流,充分运用所学的知识。 3、 测试数据测试数据 data.txt 中的数据如下: 文件 1: It is quite understandable for par
3、ents to send their children to study overseas because they place high expectations on their children. They are encouraged by the success stories of those who have completed their overseas study. With the development of economy, companies and institutions at home are giving more and more emphasis on
4、overseas experiences, too. Consequently, pursuing overseas study became a kind of short cut in gaining a better future. Moreover, there is still one underlying reason for this rusheconomic reason. The rapid economic progress in the past few years in China has enabled more and more parents to afford the huge cost for their childrens overseas study. 4、算法思想、算法思想 算法大致轮廓 (1)从 data.txt 中读取一个字符串, 然后判断该字符串最后一个字母