编程菜鸟的日记-初学尝试编程-编写函数实现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 ...
随机推荐
- windows解压.tar00文件
通常是单个文件太大分拆出来的,例如data.tar00, data.tar01, data.tar02等 cmd命令行进入几个tar0x文件所在目录,执行: copy /b data.tar0* da ...
- JDK1.8 JVM参数配置
JAVA_OPTS=" -server #服务器模式 -Xmx4g #JVM最大允许分配的堆内存,按需分配 -Xms4g #JVM初始分配的堆内存,一般和Xmx配置成一样以避免每次gc后JV ...
- C# 5.0 CallerMemberName CallerFilePath CallerLineNumber获取调用方法名称,路径,行号
class Program { static void Main(string[] args) { Log("测试"); Console.Read(); } public stat ...
- C# 之 4个访问修饰符和8个声明修饰符详解
一.4个访问修饰符(是添加到类.结构或成员声明的关键字) [1] Public:公有的,是类型和类型成员的访问修饰符.对其访问没有限制. [2] Internal:内部的,是类型和类型成员的访问修饰符 ...
- python全栈开发day101-认证组件、权限组件、频率组件
1.Mixins类分析 这两个函数都在GenericAPIView下,这就是为什么必须搭配继承GenericAPIView的原因. 这两个主要是get_object()较为复杂. 2.认证组件源码分析 ...
- tmux 安装
安装libevent wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz tar xzv ...
- spark操作Kudu之写 - 使用DataFrame API
在通过DataFrame API编写时,目前只支持一种模式“append”.尚未实现的“覆盖”模式 import org.apache.kudu.spark.kudu._ import org.apa ...
- python各个包的用途
python中的多个包的用途 1.Numpy Numpy提供了两种基本的对象:ndarray和ufunc.ndarray是存储单一数据类型的多维数组,而ufunc是能够对数组进行处理的函数. N维数组 ...
- sendfile
Sendfile 函数在两个文件描写叙述符之间直接传递数据(全然在内核中操作,传送),从而避免了内核缓冲区数据和用户缓冲区数据之间的拷贝,操作效率非常高,被称之为零拷贝. Sendfile 函数的定义 ...
- js获取背景颜色
//js获取背景颜色var Airport=$("#Airport").css('background-color'); js设置背景颜色 $("#intercity&q ...