OJ刷题之写一函数,将两个字符串连接
来源:互联网 发布:户口本生成器软件 编辑:程序博客网 时间:2024/05/16 10:34
问题及代码:
/* * Copyright (c) 2014, 烟台大学计算机与控制工程学院 * All rights reserved. * 文件名称:test.cpp * 作 者:郝俊宇 * 完成日期:2014年 12 月 28 日 * 版 本 号:v1.0 * * 问题描述:写一函数,将两个字符串连接 * 输入描述:两行字符串 * 程序输出:链接后的字符串 */ #include <iostream>#include <cstdio>using namespace std;int main(){ char str1[50],str2[50],str3[100]; int i=0,j=0,k=0; gets(str1); while (str1[i]!='\0') { str3[k++]=str1[i++]; } gets(str2); while(str2[j]!='\0') { str3[k++]=str2[j++]; } str3[k]='\0'; puts(str3); return 0;}
运行结果:
学习心得:
输入输出字符串时不能用cin.cout.
0 0
- OJ刷题之写一函数,将两个字符串连接
- 数组之写一函数,将两个字符串连接
- 写一函数,将两个字符串连接
- 写一函数,将两个字符串连接
- 写一函数,将两个字符串连接
- 写一函数,将两个字符串连接
- 写一函数,将两个字符串连接
- 写一函数,将两个字符串连接
- 第十五周oj训练——写一函数,将两个字符串连接(1052)
- 第15周OJ实践5 写一函数,将两个字符串连接
- 第15周 oj Problem E: 写一函数,将两个字符串连接
- 【入门】写一函数,将两个字符串连接 【函数】
- 8.6 写一函数,将两个字符串连接。
- 第十五周-写一函数,将两个字符串连接
- 第十五周 写一函数,将两个字符串连接
- 写一个函数,将两个字符串连接,即编写一strcat函数
- 第十五周 写一个函数,将两个字符串连接
- 习题 7.6 写一个函数,将两个字符串连接。
- 半年程序员的感想
- KVM笔记
- codeigniter数据库操作函数大全
- response.setContentTypehe和response.setCharacterEncoding
- 第18周OJ--字符串排序
- OJ刷题之写一函数,将两个字符串连接
- Nginx HTTP模块的配置项管理
- 排序:二分查找
- 【联赢娱乐平台】联赢总裁:896407891
- C++ unnion
- 大正数减法(华为2013校园招聘上机笔试题 )
- Eclipse 3.5 以后安装插件很慢的解决办法
- linux——(1)linux系统的无人值守安装
- Codec Engine 概要