#include#include#define min(a,b)!(b<a)?a:bint main(){ int a=1,b=2; std::cout<<(std::min)(a,b); return 0; }加入一个括号,std::min就不会被宏替代了。
分类:
其他好文 时间:
2014-07-02 21:20:14
阅读次数:
197
先上一个场景的基本模版: 1 local ModelScene = class("ModelScene", function() 2 return display.newScene("ModelScene") 3 end) 4 5 function ModelScene:ctor() 6 ...
分类:
其他好文 时间:
2014-07-02 21:17:07
阅读次数:
334
js 去除空格与换行//去除空格 String.prototype.Trim = function() { return this.replace(/\s+/g, ""); } //去除换行 function clearBr(key) { key = key.replace(//g,""...
分类:
Web程序 时间:
2014-07-02 21:16:23
阅读次数:
268
在GameViewController.swift中重载prefersStatusBarHidden方法,返回trueoverride func prefersStatusBarHidden() -> Bool { return true}
分类:
其他好文 时间:
2014-07-02 21:12:29
阅读次数:
1108
引言:scanf函数虽然是学习C语言时比较早就接触的一个函数,但在使用过程中,发现真正掌握它却并不容易。本文就通过各种例子来详细的总结一下该函数的各种用法,假设它的调用格式为 scanf("",)。
1、一般使用scanf函数时都是为某个变量赋值,不考虑它的返回值。但是任何函数都是需要返回的(即使返回类型用void,也可以认为只是调用了return语句,只是并没有返回什么东西而已),同样...
分类:
编程语言 时间:
2014-07-02 09:40:33
阅读次数:
210
如果你能理解下面代码的运行结果,应该就算理解闭包的运行机制了。
var name = "tom";
var myobj = {
name: "jackson",
getName: function () {
return function () {
return this.name;
...
分类:
编程语言 时间:
2014-07-02 09:25:07
阅读次数:
230
实现浮点类型的幂运算,函数原型为:
double pow(double x, int n)
在求解这个问题的时候是一个很挣扎的过程,因为它不是报错而是一直提示你超出时间,那么必须一次次的考虑怎样降低时间复杂度。
首先最直接的思路是下面这样的,就跟直观的数学求解一样。
double pow(double x, int n)
{
if(n==0)
return 1.0;
...
分类:
其他好文 时间:
2014-07-02 09:21:49
阅读次数:
179
点我点我点我!!!
接下来要做的就是模拟上述过程了。
静下来想一下自己要得到的信息。
然后拿出来,就可以了,模拟嘛,都是这样的。
#include
#include
#include
#include
using namespace std;
char str[20];
int gcd(int a,int b)
{
return a%b==0?b:gc...
分类:
其他好文 时间:
2014-07-02 09:17:57
阅读次数:
159
【题目】
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
click to show clarification.
Clarification:
What constitutes a word?
A sequence of non-space characters constitutes a word....
分类:
其他好文 时间:
2014-07-02 08:34:34
阅读次数:
170
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first
two lists.
代码如下:
* Definition for singly-linked list.
* struct L...
分类:
其他好文 时间:
2014-07-02 07:23:59
阅读次数:
159