编写函数insert(char s1[ ],char s2[ ],int pos),实现在字符串s1中的指定位置pos处插入字符串s2。

日期:2016-10-05 08:37:10 人气:3

编写函数insert(char s1[ ],char s2[ ],int pos),实现在字符串s1中的指定位置pos处插入字符串s2。

#include #include void insert(char s1[ ],char s2[ ],int pos) { if(pos<1) return ; int i,j; char str_h[50]; char str_t[50]; for(i=0;i<pos;i++) { str_h[i]=s1[i]; } str_h[i]='\0'; j=0; while(s1[i]) { str_t[j
    A+
热门评论