面试题 46 1+ 2+3+...+n

class Temp{

public:
Temp(){
++N;
sum+=N;
}
static void Reset(){
N = ;
sum = ;
}
static int getSum(){
return sum;
} private:
static int N;
static int sum;
};
int Temp::N = ;
int Temp::sum = ; int sum(int n){ Temp::reset();
Temp * a = new Temp[n];
delete []a;
return Temp::getSum(); }
上一篇:Mac OS X 下安装python的MySQLdb模块


下一篇:bnu 4353 删格游戏(博弈)