c語言從鍵盤輸入兩個字串,將字串連線到字串的後面,並輸出連線

2021-07-01 01:11:15 字數 955 閱讀 8737

1樓:

#include

#include

int main(){

char* s1;

char* s2;

char* output="";

printf("please input the first string:");

scanf("%s",s1);

printf("please input the second string:");

scanf("%s",s2);

strcat(output,s1);

strcat(output,s2);

printf("result is \"%s\"",output);

return 0;

擴充套件資料輸入10個字串存入二維字元陣列中, * 求出其中最大者並輸出。

char input[10][100];

char * max = &input[0];

for (int i = 0; i <

if (strcmp(max, &input[i]) < 0) max = &input[i];

printf("%s", max);

2樓:

1、新建一個工程和.c檔案 ,輸入標頭檔案和主函式。

2、定義變數型別。

3、呼叫cpy函式。

4、定義一個函式,並定義變數型別。

5、用一個for 語句和if語句判斷是否為母音。

6、最後加一個字串結束符,並在主函式中輸出。

7、編譯。執行得到最後結果。

3樓:

#include

#include

int main(int argc,char *argv)

從鍵盤輸入兩個包含空格字串,如果兩個字串相同,返回0,如果兩個字元不相同,輸出不

include int strcmp1 char p1,char p2 for p1 p1 p2 p1 p2 return p1 p2 int main char s1 200 s2 200 gets s1 gets s2 printf d n strcmp1 s1,s2 return 0 j a ...

c語言輸入字串,將該字串中從第m個字元開始的全部字元複製到另字串

這樣 include include int main void copystr char char int int m char str1 20 str2 20 printf input string gets str1 printf which character that begin to c...

C語言程式設計編寫程式,從鍵盤輸入字串放在字元陣列a中,用選擇法將a中的有效字元按降序排列

include int main puts s return 0 c語言程式設計 編寫程式,從鍵盤輸入一個字串放在字元陣列a中,用選擇法將a中的有效字元按降序排列 include include include void inorder char array,int n int main int a...