编程菜鸟的日记-初学尝试编程-编写函数实现strcmp功能
#include <iostream>
using namespace std;
int mystrcmp(const char *str1,const char *str2)
{
assert(*str1!='\0' && *str2!='\0');
while(*str1!='\0' && *str2!='\0' && *str1==*str2)
{
str1++;
str2++;
}
return *str1-*str2;
}
int main()
{
char str1[]=" ";
char str2[]="abc";
int a=mystrcmp(str1,str2);
cout<<a<<endl;
system("pause");
return 0;
}
编程菜鸟的日记-初学尝试编程-编写函数实现strcmp功能的更多相关文章
- 编程菜鸟的日记-初学尝试编程-编写函数实现strcat
#include <iostream>using namespace std;char *mystrcat(const char *str1,const char *str2){ char ...
- 编程菜鸟的日记-初学尝试编程-编写函数实现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 ...
随机推荐
- golang 请求带验证信息的坑
最近用golang 和python对接接口,由于之前验证那块没有设置好,然后又为了进度,最近决定用http自带的basic 验证, php的代码很快就验证通过了 /** * @param $url * ...
- zookeeper 学习 zookeeper下载部署
下载 http://mirror.bit.edu.cn/apache/zookeeper/ 校验 解压后得到zookeeper-3.4.10.jar,使用md5sum zookeeper-3.4.10 ...
- (转载)Memcached和Redis简介
转载自: Memcached和Redis简介 博主的Redis资料列表.http://www.cnblogs.com/programlearning/category/1003158.html 前言: ...
- Spring MVC基础知识整理➣拦截器和自定义注解
概述 Spring MVC中通过注解来对方法或者类进行动态的说明或者标注,类似于配置标识文件的属性信息.当标注的类或者方式被使用时候,通过提取注解信息来达到对类的动态处理.在 MVC中,我们常用的注解 ...
- [转]10 Awesome Indicator Applets for Ubuntu’s Unity Desktop
http://blogger.gtwang.org/2013/10/awesome-indicator-applets-for-ubuntus-unity-desktop.html http://ww ...
- scrapy笔记
1.关于请求url状态码重定向问题: from scrapy import Request handle_httpstatus_list = [404, 403, 500, 503, 521, 522 ...
- tmux 安装
安装libevent wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz tar xzv ...
- python--pip出错
问题: 1.使用pip install时,出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None) ...
- Python 扫盲
yield使用浅析 菜鸟教程:http://www.runoob.com/w3cnote/python-yield-used-analysis.html #!/usr/bin/python # -*- ...
- detailFormatter bootstrapTable
detailView : true,//会导致表格最开头多出一列 detailFormatter :function(index, row, element){ var image = '<di ...