编程菜鸟的日记-初学尝试编程-编写函数实现strcat
#include <iostream>
using namespace std;
char *mystrcat(const char *str1,const char *str2)
{
char *dst;
dst=(char *)malloc(sizeof(str1)+sizeof(str2));
char *start=dst;
while(*dst=*str1)
{
dst++;
str1++;
}
while(*dst=*str2)
{
dst++;
str2++;
}
*dst='\0';
return start;
}
void main()
{
char str1[]=" ";
char str2[]="abc";
char *a=mystrcat(str1,str2);
cout<<a<<endl;
system("pause");
}
编程菜鸟的日记-初学尝试编程-编写函数实现strcat的更多相关文章
- 编程菜鸟的日记-初学尝试编程-编写函数实现strcmp功能
#include <iostream>using namespace std;int mystrcmp(const char *str1,const char *str2){ assert ...
- 编程菜鸟的日记-初学尝试编程-编写函数实现strlen功能(总结考察点)
//考察点1:输入参数加const int Mystrlen(const char *str) {//考察点2:断言字符串非0 assert(str!=NULL); int len=0;//考察点3: ...
- 编程菜鸟的日记-初学尝试编程-编写函数实现strcpy功能(总结考察点)
char *Mystrcpy(char *strDest, const char *strSrc) //考察点1:将源字符串加const,表明为输入参数 {//考察点2:对源地址和目的地址的非0断言 ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9
#include <iostream> #include <fstream> #include <cstdlib> #include <string> ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8
#include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7
#include <iostream> #include <string> #include <cctype> using namespace std; int m ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6
#include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5
#include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4
#include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showm ...
随机推荐
- vsftp日志xferlog格式分析
vsftp日志xferlog格式分析 [日期:2014-06-25] 来源:Linux社区 作者:Linux [字体:大 中 小] 1.开始vsftp记录日志.修改/etc/vsftpd/vsf ...
- 437. 路径总和 III
方法一:48 ms /* sumUp递归子程序求解以root为根节点的子节点之和为sum的路径数目; pathSum递归部分是把根节点逐一考察,如以root->left,以root->ri ...
- mysql四大特性与四种隔离级别
四大特性 1:原子性.事务是一个不可分割的整体,事务开始的操作,要么全部执行,要么全部不执行. 2:隔离性.同一时间,只允许一个事务请求同一组数据.不同的事务彼此之间没有干扰. 3:一致性.事务开始前 ...
- Nodejs通过账号密码连接MongoDB数据库
转自https://blog.csdn.net/szu_lzz/article/details/77435804#commentBox 1.创建管理员 首先开启Mongo服务,然后切换admin数据库 ...
- HTML自定义滚动条(仿网易邮箱滚动条)转载
它是使用CSS中的伪元素来实现的,主要由以下三个来完成: 1. -webkit-scrollbar:定义滚动条的样式,如长宽. 2. -webkit-scrollbar-thumb:定义滚动条上滑块的 ...
- 学号:20165239 预备作业3 Linux安装及学习
实验三 用户及文件权限管理 之前从未接触过虚拟机,借着老师布置的任务,这次寒假初次接触了虚拟机,既紧张又兴奋,在学习了老师的一部分教程以及查阅网上的资料之后,有了以下的学习笔记和心得. 一.Linux ...
- Codeforces 542D Superhero's Job 数论 哈希表 搜索
原文链接https://www.cnblogs.com/zhouzhendong/p/CF542D.html 题目传送门 - CF542D 题目传送门 - 51Nod1477 题意 定义公式 $J(x ...
- 51Nod1577 异或凑数 线性基
原文链接https://www.cnblogs.com/zhouzhendong/p/51Nod1577.html 题意 给定一个长度为 n 的序列. 有 m 组询问,每一组询问给出 L,R,k ,询 ...
- python面试题之如何用Python输出一个斐波那契数列
so eary! 1 a,b = 0, 1 2 while b<100: 3 print (b), 4 a, b = b, a+b 本文转载自:python黑洞网 原文链接:http://www ...
- Linux下C语言的进程控制编程
代码: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/ty ...