| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 708 人关注过本帖
标题:串替换有点错误,各位大神忙帮看看
取消只看楼主 加入收藏
寻找梦想1
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2013-5-1
结帖率:50%
收藏
已结贴  问题点数:5 回复次数:0 
串替换有点错误,各位大神忙帮看看
#include "stdio.h"
#include "stdlib.h"

#define MAXSTRLEN 255
typedef unsigned char SString[MAXSTRLEN+1];
int Index(SString s1,SStrings2,int pos)
{
  }
 Status StrDelete(SString s,int pos,int len)
{
    int i;
    if(pos<1||pos>s[0]-len+1||len<0)
    return 0;
   for(i=pos+len;i<=s[0];i++)
    s[i-len]=s[i];
   s[0]=len;
   return 1;
}


void Replace(SString s1,SString s2,SString s3)
{
  int i;
char t;
do
  {
     i=Index(s1,s2,i);
     if(i)
     {
        StrDelete(s1,i,s2[0]);
      t=(StrInsert(s1,i,s3));
    if(!t)
     return 0;
    else
      i+=s3[0];
   }whlie(i);
}
 main()
{int i;char t;
 SString s1,s2,s3;
 printf("请输入串s1:");
 scanf("%s",s1);
 printf("请输入串s2:");
 scanf("%s",s2);
t=Replace(s2,i,s3);
printf("the replaced s1:%s",s1);
}  
搜索更多相关主题的帖子: pos include return 
2013-05-23 21:45
快速回复:串替换有点错误,各位大神忙帮看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026377 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved