【1】Virtual是C++
OO机制中很重要的一个关键字。只要是学过C++的人都知道在类Base中加了Virtual关键字的函数就是虚拟函数(例如下面例子中的函数print),于是在Base的派生类Derived中就可以通过重写虚拟函数来实现对基类虚拟函数的覆盖。当基类Base的指针point指向...
分类:
编程语言 时间:
2014-05-14 02:11:02
阅读次数:
352
Continuous Login
Time Limit: 2 Seconds Memory Limit: 131072 KB Special Judge
Pierre is recently obsessed with an online game. To encourage users to log in, this game will give user...
分类:
其他好文 时间:
2014-05-14 01:25:00
阅读次数:
396
1 /** 2 旋转卡壳,, 3 **/ 4 #include 5 #include 6
#include 7 #include 8 using namespace std; 9 10 const double eps = 1e-8; 11
struct point {...
分类:
其他好文 时间:
2014-05-13 21:35:05
阅读次数:
374
1 #include 2 #include 3 #include 4 #include 5 using
namespace std; 6 7 struct point{ 8 int x,y; 9 };10 11 struct line{12 point
a,b;13 };14...
分类:
其他好文 时间:
2014-05-13 20:29:09
阅读次数:
292
1 /** 2 判断直线位置关系 3 **/ 4 #include 5 #include 6
#include 7 using namespace std; 8 struct point { 9 double x,y;10 point(double
x=0,double y=...
分类:
其他好文 时间:
2014-05-13 20:28:07
阅读次数:
254
One Person Game
Time Limit: 1 Second Memory Limit: 32768 KB Special Judge
There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 ha...
分类:
其他好文 时间:
2014-05-13 06:06:00
阅读次数:
357
本段程序主要利用数据结构栈的先进后出特点,实现回溯求解迷宫路径问题。
#include
#include
using namespace std;
//坐标类
struct Point
{
int x;
int y;
};
//地图类
template
struct Map
{
int (*p)[A];
int row;//行数
int col;//列数
};
//start起始点, ...
分类:
其他好文 时间:
2014-05-13 05:25:02
阅读次数:
478
理解二级指针,关键是理解指针的存储方式和意义。
这里以指向int型指针的指针为例,梳理一下二级指针在内存分配中 的奥妙....
#include
using namespace std;
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int *p = a;
int **point = &p;
cout << "a = "...
分类:
其他好文 时间:
2014-05-12 23:22:28
阅读次数:
291
在c++中,有2种class data
member:static和nostatic,以及3钟class member
function:static,nostatic和virtual。已知下面这个class Point声明:class Point{public:
Point(float xv...
分类:
编程语言 时间:
2014-05-12 21:43:54
阅读次数:
370