【1】Virtual是C++
OO机制中很重要的一个关键字。只要是学过C++的人都知道在类Base中加了Virtual关键字的函数就是虚拟函数(例如下面例子中的函数print),于是在Base的派生类Derived中就可以通过重写虚拟函数来实现对基类虚拟函数的覆盖。当基类Base的指针point指向...
分类:
编程语言 时间:
2014-05-14 02:11:02
阅读次数:
352
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Same Tree
Total Accepted: 15922 Total
Submissions: 38418
Given two binary trees, write a function to check if they are equal o...
分类:
其他好文 时间:
2014-05-14 01:15:40
阅读次数:
293
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
1 /** 2 极角排序输出,,, 3 主要atan2(y,x) 容易失精度,,用 4 bool
cmp(point a,point b){ 5 if(cross(a-tmp,b-tmp)>0) 6 return 1; 7
if(cross(a-tmp,b-tmp)...
分类:
其他好文 时间:
2014-05-13 20:05:34
阅读次数:
242
1 #include 2 #include 3 #include 4 #include 5
#include 6 using namespace std; 7 struct point { 8 double x,y; 9 };10 point
be[100005],en[100...
分类:
其他好文 时间:
2014-05-13 20:03:30
阅读次数:
288
本段程序主要利用数据结构栈的先进后出特点,实现回溯求解迷宫路径问题。
#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
#!/bin/bash
#checkmysqlslavestatus
USER="check"
PSW="***"
RUNTIME=3600
ADDR="192.168.*.*"
declare-aslave_is
forIPin$ADDR
do
slave_is=($(/usr/local/mysql/bin/mysql-h$IP-u${USER}-p${PSW}-e"showslavestatus\G"|grepRunning|awk‘{print$2}‘))
if["${slave_is[0]}"="Y..
分类:
数据库 时间:
2014-05-13 04:33:44
阅读次数:
374
理解二级指针,关键是理解指针的存储方式和意义。
这里以指向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