1樓:碧海風雲
#include
#include
#define len 20
/*將src插入至des的pos處*/
void insertstr (char *des, char *src, int pos) {
char *posp = des+pos; /*指向des之pos處的指標*/
char front[len],back[len]; /*暫存字串*/
int i;
i=0;
while (des
執行結果
2樓:匿名使用者
要輸出而已,所以,判斷長度,取中值。。。。。。先輸出s1前段、輸出s2、輸出s2後端~~~~
3樓:匿名使用者
#include
#include
using namespace std;
char *insertstring(char *dest, const char *source,int pos) ;
int main()
char *insertstring(char *dest, const char *source,int pos)
c語言程式設計輸入兩個字串s1,s2,用指標實現將字串s2的內容連線到s1的末尾.
4樓:瘋狂奔跑地烏龜
這樣簡單解釋一下吧,前面都沒問題吧,就mystrcat函式裡面,你看它有兩個引數對吧,然後又定義了一個str,先讓str指向str1,用while迴圈輸出str1,輸出完後進入第二個while迴圈str繼續++ ,不過就把str2地址賦給它了,等於第二個while迴圈就輸出了str2。 思路夠清晰了吧。不懂再追問。
5樓:hit海爾
#include
char*mystrcat(char*str1,char*str2); 函式說明
void main()
char*mystrcat(char*str1,char*str2)求每一步的詳細解釋
c語言:從鍵盤輸入兩個字串s1與s2,並在s1串中的最大字元後邊插s2 20
6樓:
//#include "stdafx.h"//vc++6.0加上這一行.
#include "stdio.h"
#include "string.h"
void main(void)
strcats2,s1+sub+1);
s1[sub+1]='\0';
strcat(s1,s2);
printf("the result is %s\n",s1);//look at it.}
7樓:冰是沉默的水
什麼叫 「s1串中的最大字元」?
scanf("%s",s1);
scanf("%s",s2);
strcat(s1,s2);
printf("%s",s1);
2 用VB程式程式設計 從鍵盤上輸入整數,並放入一維陣列中,然後將其前元素與後元素對換
司寇忻 private sub command1 click dim tmp as string,tmp1 as string,a as string me.cls tmp text1.text if not isnumeric tmp then goto outerr a split tmp,if...
編寫程式實現從鍵盤上任意輸入正整數,找出其中的素數
include include void main for j 0 j printf 按從小到大順序排列為 d n ptr j free ptr includevoid main i,j,flag,k 0,temp,n printf 請輸入正整數的個數 scanf d n printf 請輸入 d個...
編寫c語言程式,實現交換兩個變數值的操作
int白 include int main 我這樣做可以換值,不過我總覺得有點怪怪的。 用一箇中間變數代換,就是比較兩個數的大小的那種方法 編寫c語言程式,實現交換兩個變數值的操作。要求 使用形參為指標的函式swap完成交換功能。主函式中,使用整型指標從鍵盤輸入兩個整數,通過呼叫swap完成交換輸出...