九度 题目1490:字符串链接
来源:互联网 发布:方舟生存进化优化 2016 编辑:程序博客网 时间:2024/06/05 08:31
题目来源:http://ac.jobdu.com/problem.php?pid=1490
- 题目描述:
不用strcat 函数,自己编写一个字符串链接函数MyStrcat(char dstStr[],charsrcStr[])
- 输入:
两个字符串,字符串由小写字母组成。
- 输出:
链接后的字符串
- 样例输入:
hello worldgood morning
- 样例输出:
helloworldgoodmorning
- 来源:
- 2012年哈尔滨工业大学计算机研究生机试真题
#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int MAXN = 1010;char str[MAXN];void MyStrcat(char *str1, char *str2){ int Len1, Len2, Len; Len1 = strlen(str1); Len2 = strlen(str2); Len = Len1 + Len2; int i = 0; char str[Len+3]; while(str1[i] != '\0') str[i] = str1[i], i++; int j = 0; while(str[j] != '\0') str[i] = str2[j], i++, j++; str[i] = '\0'; printf("%s\n", str);}int main(){ char str1[MAXN], str2[MAXN]; while(~scanf("%s %s", str1, str2)) { MyStrcat(str1, str2); str[0] = '\0', str1[0] = '\0', str2[0] = '\0'; } return 0;}
0 0
- 九度 题目1490:字符串链接
- 九度 题目1490:字符串链接
- 题目1490:字符串链接
- 题目1490:字符串链接
- 题目1490:字符串链接
- 题目1490:字符串链接
- 【九度OJ】1490【字符串链接】【C实现】【哈工大2012】
- 九度OJ 题目1066:字符串排序
- 九度OJ 题目1206:字符串连接
- 九度OJ 题目1192:回文字符串
- 九度OJ 题目1135:字符串排序
- 九度OJ 题目1192:回文字符串
- 题目1369:字符串的排列-九度
- 九度题目:字符串排序(1135)
- 【九度】题目1054:字符串内排序
- 【九度】题目1135:字符串排序
- 九度题目1054:字符串内排序
- 九度 题目1369:字符串的排列
- 关于二分查找
- MyEclipse工具的使用
- HDU 2066 - 一 个人的旅行(最短路)
- 黑马程序员_Java基础——异常(第1篇)
- JMAIL 80040154 错误
- 九度 题目1490:字符串链接
- Effective C# Item23:避免返回内部类对象的引用
- 命令行进入ftp服务器
- 位图法排序
- mysql_query("set names gb2312")设置客户端字符集
- java中 String s=new String(""); String s="";
- cocos2d-x xml解析
- android Field类的讲解
- 二在目标责任制厅地夺取