正在加载图片...
Status StrInsert(HString &s, int pos, HString T) ∥在串5的第pos个位置前插入T if (pos <1 pos>s length+1)return ERROR; if (T length)t if ((sch=(char ealloc(sch, (S length+T length)*sizeof(char))) exit(OVERFLOW) for(i=s length-1; i>=pos-1; -i) sch[i+T length]=S ch[] for (i=0; K<=Tlength-1; i ++ sch[pos-1+iT.ch[] Slength+=Tlength; s return OK,Status StrInsert(HString &S,int pos,HString T) //在串S的第pos个位置前插入串T { int i; if (pos<1||pos>S.length+1) return ERROR; if (T.length){ if (!(S.ch=(char*) realloc(S.ch,(S.length+T.length)*sizeof(char)))) exit(OVERFLOW); for (i=S.length-1;i>=pos-1;--i){ S.ch[i+T.length]=S.ch[i]; } for (i=0; i<=T.length-1;i++) S.ch[pos-1+i]=T.ch[i]; S.length+=T.length; } return OK; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有