6.13编一程序,将两个字符串连接起来,不要用strcat函数。
2019-01-23 19:13
316 查看
//C程序设计第四版(谭浩强) //章节:第六章 利用数组处理批量数据 //题号:6.13 //题目:编一程序,将两个字符串连接起来,不要用strcat函数。 #include <stdio.h> #include <string.h> int main() { char s1[40],s2[40],s[80]; int len1,len2,i; printf("input string1:\n"); gets(s1); printf("input string2:\n"); gets(s2); len1=strlen(s1); len2=strlen(s2); for(i=0;i<len1;i++) s[i]=s1[i]; for(i=0;i<len2;i++) s[i+len1]=s2[i]; printf("after string catenate:\n"); puts(s); return 0; }
相关文章推荐
- 习题 6.13 编一程序,将两个字符串连接起来,不要用strcat函数。
- 编一个程序,将两个字符串连接起来,不要用strcat函数。
- 编一程序,将两个字符串连接起来,不要用strcat函数。
- 实验5-7 编写程序,将两个字符串连接起来,不要用strcat函数。
- 将两个字符串连接起来,不要用strcat函数。
- 7.13 编写一个程序,将两个字符串连接起来,不要用strcat函数。
- 【c语言】将两个字符串连接起来,不要用strcat函数
- 编写一程序,将两个字符串连接起来的3种方法
- 编写一程序,将两个字符串连接起来的3种方法
- 将两个字符串连接起来,不要用strcat
- 编一程序,将两个字符串连接起来,即实现strcat函数功能
- 飛飛(八十)(补)请构造String类的加、减运算(s1+s2将两个字符串的连接起来;s1-s2是将s1的尾部空格和s2的前导空格去除后的连接)
- 编写一个程序,将两个字符串链接起来, 结果取代第一个字符串
- 第十三周项目5——2 将两个字符串连接起来
- 程序46:两个字符串连接程序
- 在Matlab中,想要将两个字符串连接在一起,有以下的方法: 假定有两个字符串 >> str1='Iloveyou';str2='123'; 方法一:用中括号将str1和str2像矩阵元素一样包含起来
- C语言 不使用strcat函数实现连接两个字符串功能
- 6.14编一个程序,将两个字符串s1和s2比较,不要用strcpy函数。
- 写一个函数,将两个字符串连接,即编写一strcat函数
- 输入两个字符串,不用系统提供的函数strcat,自定义函数将两个字符串连接起来。