字串連線

2021-09-11 12:35:04 字數 456 閱讀 3050

answer1:char型別

利用cin不包括空格的天然特性,讀取兩個字串,直接按序輸出

**:

#include 

#include

using namespace std;

int main()

return0;

}

answer2:string型別

對於string型別變數,我們可以直接用"+"進行連線操作;

**:

#include

#include

#include

#include

using namespace std;

int main()

return0;

}

補充:string型別變數的連線

字串連線

輸入n個字串s i 你要把他們按某個順序連線起來,使得字典序最小。1 n 100 每個字串長度 100 字串只包含小寫字母 input 第一行乙個整數n。接下來每行乙個字串s i output 一行乙個字串表示把輸入的n個字串按某個順序連線之後的結果input示例 6 itlooks like an...

字串連線

mysql select abc 123 abc 123 123 1 row in set,1 warning 0.00 sec mysql select 123 123 123 123 246 1 row in set 0.00 sec mysql select 123 123 123 123 2...

matlab字串連線

在matlab中,想要將兩個字串連線在一起,有以下的方法 假定有兩個字串 str1 iloveyou str2 123 方法一 用中括號將str1和str2像矩陣元素一樣包含起來 sc str1,str2 sc iloveyou123 若想驗證str1和str2確實被連線起來,可呼叫length函式...