首页 > 代码库 > 九度-
九度-
- http://ac.jobdu.com/problem.php?pid=1206
- 题目描述:
-
不借用任何字符串库函数实现无冗余地接受两个字符串,然后把它们无冗余的连接起来。
- 输入:
-
每一行包括两个字符串,长度不超过100。
- 输出:
-
可能有多组测试数据,对于每组数据,
不借用任何字符串库函数实现无冗余地接受两个字符串,然后把它们无冗余的连接起来。
输出连接后的字符串。
- 样例输入:
-
abc def
- 样例输出:
-
abcdef
- 来源:
- 2010年华中科技大学计算机保研机试真题
直接使用string,会比char[]方便一些。
1 #include <iostream> 2 #include <string.h> 3 #include <string> 4 5 using namespace std; 6 7 string str1, str2; 8 9 int main() 10 { 11 string ans; 12 while(cin>>str1, cin>>str2) 13 { 14 ans=str1+str2; 15 cout << ans <<endl; 16 } 17 return 0; 18 }
九度-
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。