码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
【c语言】实现一个函数,求字符串的长度,不允许创建第三方变量
// 实现一个函数,求字符串的长度,不允许创建第三方变量。 #include #include int my_strlen_no(char const *p) { assert(p != NULL); if (*p == NULL) return 0; else return (1 + my_strlen_no(p + 1)); } int main() { char ...
分类:编程语言   时间:2015-07-02 12:21:07    阅读次数:144
【c语言】模拟实现strchr函数,功能:在一个字符串中查找一个字符第一次出现的位置,如果没有出现返回NULL
// 模拟实现strchr函数,功能:在一个字符串中查找一个字符第一次出现的位置,如果没有出现返回NULL #include #include char const* my_strchr(char const *p,char c) { assert(p != NULL); while (*p) { if (*p == c) return p; else p++; ...
分类:编程语言   时间:2015-07-02 12:18:02    阅读次数:135
poj 1694 An Old Stone Game 树形dp
//poj 1694 //sep9 #include #include using namespace std; const int maxN=256; int n; int tree[maxN][maxN]; int ans[maxN]; int cmp(int a,int b) { return a>b; } int dfs(int u) { int tmp[maxN],t=0; i...
分类:其他好文   时间:2015-07-02 12:09:15    阅读次数:148
C++ Sort类成员的传递
C++模板中提供了sort方法,一般有两种方法:传递函数,传递一个对象。第一种方法:函数bool compare(const string &strLeft, const string &strRight){ return strLeft vtstrTest; vtstrTest.pus...
分类:编程语言   时间:2015-07-02 12:02:53    阅读次数:124
29 Divide Two Integers
29 Divide Two Integers链接:https://leetcode.com/problems/divide-two-integers/ 问题描述: Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.Hide T...
分类:其他好文   时间:2015-07-02 10:23:47    阅读次数:113
用protractor测试canvas绘制(二)
上一篇写了通过webdriver在浏览器环境下异步调用js代码。 今天进入正题。 其实有了executeAsyncScript,一切就呼之欲出了。 直接上代码: var compareImage=function(){ return function(){ eval(arguments[0]); var canvasBase64=argume...
分类:其他好文   时间:2015-07-02 10:18:15    阅读次数:113
swift 可变参数
func sumof(numbers:Int...)->Int{  var sum = 0;  for number in numbers{   sum+=number;  }  return sum; } sumof(); sumof(43,23,12);...
分类:编程语言   时间:2015-07-02 10:07:19    阅读次数:131
leetCode(27):Maximal Square
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 ...
分类:其他好文   时间:2015-07-02 10:07:01    阅读次数:115
【C语言】模拟实现库函数srtcpy函数
//模拟实现库函数srtcpy函数 #include #include char * my_strcpy(char *dst, const char *src) { char *start = dst; assert(dst); assert(src); while (*dst++ = *src++) { ; } return start; } int main() { c...
分类:编程语言   时间:2015-07-02 10:03:11    阅读次数:172
【C语言】实现一个函数求字符串长度(不能创建第三方变量)
//实现一个函数求字符串长度(不能创建第三方变量) #include #include int my_strlen(const char *p) { assert(p); if (*p == '\0') return 0; else return 1 + my_strlen(++p); } int main() { char *p = "abcdefg"; printf("%...
分类:编程语言   时间:2015-07-02 10:03:04    阅读次数:113
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!