将两个字符串连接起来,不要用strcat
2017-09-23 10:46
225 查看
#include <stdio.h> int main() { char s1[80], s2[40]; int i = 0, j = 0; printf("\ninput string1:"); scanf("%s", s1); printf("\ninput string2:"); scanf("%s", s2); while(s1[i] != '\0') i++; while(s2[j] != '\0') s1[i++] = s2[j++]; s1[i] = '\0'; printf("The new string is:%s\n", s1); return 0; }
相关文章推荐
- 7.13 编写一个程序,将两个字符串连接起来,不要用strcat函数。
- 习题 6.13 编一程序,将两个字符串连接起来,不要用strcat函数。
- 编一程序,将两个字符串连接起来,不要用strcat函数。
- 输入两个字符串,不用系统提供的函数strcat,自定义函数将两个字符串连接起来。
- 将两个字符串连接起来,不要用strcat函数。
- 编一程序,将两个字符串连接起来,即实现strcat函数功能
- 实验5-7 编写程序,将两个字符串连接起来,不要用strcat函数。
- 编一个程序,将两个字符串连接起来,不要用strcat函数。
- 【c语言】将两个字符串连接起来,不要用strcat函数
- 在Matlab中,想要将两个字符串连接在一起,有以下的方法: 假定有两个字符串 >> str1='Iloveyou';str2='123'; 方法一:用中括号将str1和str2像矩阵元素一样包含起来
- 连接两个字符串,不用strcat
- c++ 连接两个字符串实现代码 实现类似strcat功能(转)
- 编写一程序,将两个字符串连接起来的3种方法
- 将两个字符串连接起来取代第一个字符串。用string方法
- 编写一程序,将两个字符串连接起来的3种方法
- strcat()连接两个字符串的问题分析
- 将两个字符串连接起来
- strcat()连接两个字符串的问题分析
- 第十三周项目5——2 将两个字符串连接起来