编程菜鸟的日记-初学尝试编程-编写函数实现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 ...
随机推荐
- 20165206 2017-2018-2 《Java程序设计》第三周学习总结
20165206 2017-2018-2 <Java程序设计>第三周学习总结 教材学习内容总结 类:class是关键字,用来定义类. 类声明:例如class People. 对象的声明:类 ...
- 静态属性property
静态属性property(是通过对象去使用) property是一种特殊的属性,访问它时会执行一段功能(函数)然后返回值 1 . 通过@property修饰过的函数属性,调用的时候无需在加() cla ...
- C# 操作windows服务[启动、停止、卸载、安装]
主要宗旨:不已命令形式操作windows服务 static void Main(string[] args) { var path = @"E:\开发辅助项目\WCF\WCF.Test\WC ...
- Windows Server 2008/2012 计划任务配置执行bat
首先Windows Server 2008不同于其他服务器操作系统和Windows Server 2003有着很大的区别,计划任务的名称是“任务计划程序”不在控制面板里,而是在“管理工具”里.由于服务 ...
- SVN不要显示问号
让SVN不要显示未进行版本控制的文件(夹)图标的问号: 1.选择TortoiseSVN→SettIngs 2.Overlays→取消勾选Unversioned,点击“应用”,然后重启电脑即可
- centos6.x完全禁用IPv6的方法
https://blog.csdn.net/prettyshuang/article/details/51731890
- jQuery滑动开关按钮效果
效果图: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 ...
- mySql中SUBSTRING_INDEX函数用法
SUBSTRING_INDEX(str,delim,count) 返回字符串 str 中在第 count 个出现的分隔符 delim 之前的子串.如果 count 是一个正数,返回从最后的(从左边开始 ...
- Python学习(十一) —— 模块和包
一.模块 一个模块就是一个包含了python定义和声名的文件,文件名就是模块名加上.py后缀. import加载的模块分为四个通用类别: 1.使用python编写的代码(.py文件) 2.已被编译为共 ...
- Codeforces 877F Ann and Books 莫队
转换成前缀和, 预处理一下然后莫队. #include<bits/stdc++.h> #define LL long long #define fi first #define se se ...