资源简介
对读入的某个文本文件input.txt中,拆出英文单词,输出一个按字典顺序排列的单词表,结果输出在文本文件output.txt中,每个单词一行,并在单词后输出该单词出现的个数,两个字段之间用逗号分隔。约定单词仅由英文字母组成,单词间由非英文字母分隔,相同单词只输出一个,大小写不区分。

代码片段和文件信息
/*
* Copyright(C) 2014 Ruijie Network. All rights reserved.
*/
/*
* main.c
* Original Author: wuyuanxia@ruijie.com.cn 2014-7-30
*
* To extract words from the input file input.txt and output words in alphabetical order to
* output.txt and record the number that each word occured.The program assumes that a word length
* no more than 20.
*/
#include
#include
#include
#include
#include “word.h“
int main (int argc char **argv)
{
FILE *fp_in;
FILE *fp_out;
list_head_t *head; /* The head of word list */
fp_in = fopen(“input.txt“ “r“);
if (fp_in == NULL) {
(void)printf(“Failed to open input file!\n“);
exit(1);
}
head = word_creat_list();
head = word_fill_list(fp_in head);
fclose(fp_in);
fp_out = fopen(“output.txt““w+“);
if (fp_out == NULL) {
(void)printf(“Failed to open output file!\n“);
exit(1);
}
word_output_list(fp_out head);
fclose(fp_out);
word_free(head);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 42 2014-07-30 15:01 单词处理作业\input.txt
文件 2640 2014-05-11 16:19 单词处理作业\list.h
文件 1051 2014-07-31 10:19 单词处理作业\main.c
文件 171 2014-07-30 14:46 单词处理作业\makefile
文件 46 2014-07-30 20:02 单词处理作业\output.txt
文件 5253 2014-07-31 09:11 单词处理作业\word.c
文件 910 2014-07-31 09:27 单词处理作业\word.h
文件 69852 2014-07-31 11:35 单词处理作业\单词处理程序运行结果报告.docx
目录 0 2014-07-31 11:40 单词处理作业
----------- --------- ---------- ----- ----
79965 9
- 上一篇:GalleryScreenshot
- 下一篇:opencv头文件以兹互勉
相关资源
- uboot到linux logo显示不间断 补丁
- UNIX/LINUX编程实践教程的源码
- Linux任务管理器
- linux应用层的华容道游戏源代码
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- 课程作业:模拟仓库管理系统
- 操作系统实验——虚存管理实验
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- linux C 电梯程序练习
- linux下用多进程同步方法解决生产者
- 一个简单实用个人日记管理系统
- 带时间温度显示的室内灯光控制系统
- 成绩管理系统(数据结构)
- Linux 操作系统实验(全)
- Linux From Scratch 中文手册
- FIR低通滤波器 ccs运行环境
- linux 网络实验 ftp程序
- Linux命令大全离线版&在线版
- 操作系统共享内存实验
- dos 下运行Linux 命令--gnu_utils
- linux 0.12内核源代码
- linux简易shell C实现
- linux实验报告及心得体会
- 基于GTK的Linux环境下的简易任务管理器
- linux扫雷游戏代码
- CAN Linux驱动代码
评论
共有 条评论