经常会在项目中用到 int to string
#include
#include
#include
using namespace std;
int main(void)
{
ostringstream num;
num << 123;
string str = num.str();
cout << str << endl;
return 0;
}...
分类:
编程语言 时间:
2014-07-22 23:04:54
阅读次数:
283
[ 问题: ]
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.
If the last word does not exist, return 0.
[...
分类:
其他好文 时间:
2014-07-22 23:01:35
阅读次数:
331
[ 问题: ]
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were
inserted in order. You may assume no duplicates in th...
分类:
其他好文 时间:
2014-07-22 23:01:15
阅读次数:
270
函数闭包
function createCountdownTimer(second)
local ms=second * 1000;
local function countDown()
ms = ms - 1;
return ms;
end
return countDown;
end
timer1 = createCountdownTimer(1);
for...
分类:
其他好文 时间:
2014-07-22 22:59:53
阅读次数:
307
Little Wish~ lyrical step~
Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 417 Accepted Submission(s): 109
Problem Description
N chi...
分类:
其他好文 时间:
2014-05-02 04:37:42
阅读次数:
393
函数指针
1. 函数与函数指针类型要匹配;
2. 函数指针用来保存函数首地址,即可以通过该指针访问函数;
3. 函数指针可以指向一类函数,而不是一个函数,即可以重新赋值。
int maxNumber(int a, int b)
{
return a > b? a: b;
}
void fileFunc(){ cout
void editFunc(){ ...
分类:
其他好文 时间:
2014-05-02 04:33:25
阅读次数:
276
求矩形和圆是否相交或相切。
#include
#include
#define judge(x,y) x<y||fabs(x-y)<0.00000001
double dis(int x,int y,int a,int b)
{
return (x-a)*(x-a)+(y-b)*(y-b);
}
int main()
{
int T;
scanf(...
分类:
其他好文 时间:
2014-04-30 22:45:38
阅读次数:
365
//由于函数是对象,所以可以直接把函数通过参数传递进来;也可以把函数作为返回值。
function calFun(fun,arg){
//第一个参数就是函数对象
return fun(arg);
}
function sum(num){
return num+100;
}
function say(str){
alert("hello "+str);
}
//...
分类:
Web程序 时间:
2014-04-30 22:41:38
阅读次数:
324
进入游戏连连第一个场景,如下:
初始化该场景精灵所需的信息、背景/音效及图层UI
bool HelloWorld::init()
{
//////////////////////////////
// 1. super initfirst
if (!CCLayer::init() )
{
return
false;...
分类:
其他好文 时间:
2014-04-30 22:34:40
阅读次数:
226
示例代码将在注册表位置:HKEY_CURRENT_USER\Software\ 读写键值
bool LicenseManage::OpenRegKey(HKEY& hRetKey)
{
if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,"Software", &hRetKey))
{
return true;
...
分类:
其他好文 时间:
2014-04-30 22:12:40
阅读次数:
195