没有合适的资源?快使用搜索试试~ 我知道了~
C语言程序设计 单词替换程序
5星 · 超过95%的资源 需积分: 44 58 下载量 127 浏览量
2010-08-07
14:57:31
上传
评论 3
收藏 1KB TXT 举报
温馨提示
试读
3页
用C语言实现单词替换的任务,在用户指定的文本中,查找特定单词,并且能根据用户需要替换成其他单词
资源推荐
资源详情
资源评论
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main(){
FILE *fp1,*fp2;
int i,lenstr2,k=0,m;
static int j,h;
char str1[100],path[128],str2[10],str3[10],path_new[128],ch,strtemp[50],*p;
printf("请输入需要进行操作文件的文件名\n");
gets(path);
printf("请您确认\n");
puts(path);
if((fp1=fopen(path,"r+"))==NULL){
printf("can not open the file\n");
exit(0);}
printf("请输入新文件名\n");
gets(path_new);
if((fp2=fopen(path_new,"w"))==NULL){
printf("can not open the file\n");
exit(0);
}
for(i=0;(feof(fp1)==0);i++){
ch=fgetc(fp1);
str1[i]=ch;
j=i;
}
for(i=0;i<j;i++){
printf("%c",str1[i]);}
#include <stdlib.h>
#include <string.h>
void main(){
FILE *fp1,*fp2;
int i,lenstr2,k=0,m;
static int j,h;
char str1[100],path[128],str2[10],str3[10],path_new[128],ch,strtemp[50],*p;
printf("请输入需要进行操作文件的文件名\n");
gets(path);
printf("请您确认\n");
puts(path);
if((fp1=fopen(path,"r+"))==NULL){
printf("can not open the file\n");
exit(0);}
printf("请输入新文件名\n");
gets(path_new);
if((fp2=fopen(path_new,"w"))==NULL){
printf("can not open the file\n");
exit(0);
}
for(i=0;(feof(fp1)==0);i++){
ch=fgetc(fp1);
str1[i]=ch;
j=i;
}
for(i=0;i<j;i++){
printf("%c",str1[i]);}
资源评论
- u0116522822013-08-14还不错,有参考价值
- svime2013-11-05还行,可以用
- sb酱2013-07-24代码不错,是我想要的
- ssjjkk42013-09-20不错,有参考价值,对我有帮助。
- msske2013-06-28不错,有参考价值,对我有帮助。
刚泡
- 粉丝: 7
- 资源: 31
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功