
C++学习
文章平均质量分 62
lazy_virus
这个作者很懒,什么都没留下…
展开
-
C++学习之内联函数
内联函数的学习。#include#include#includeusing namespace std;#define f(x) (x+1)#define floor(x,b) ((x)>=(b)?0:1)// 加括号的好处#define band(x) ((x)>5&&(x)<10 ? (x):0)inline int plusOne(int x) {return ++x;}原创 2013-06-29 15:20:18 · 613 阅读 · 0 评论 -
Date类实现
头文件:#include#includeusing namespace std;class Date{private: int year,month,day; int lunar_year,lunar_month,lunar_day; string LunarHolDay;public: int get_y(){return year;} int get_m(){retur原创 2013-12-12 18:24:06 · 1136 阅读 · 0 评论 -
疑惑代码
#include#includeusing namespace std;class Triangular{public: Triangular(){_length=1;_beg_pos=1;_next=0;} Triangular(int len,int beg_pos){_length=len; _beg_pos=beg_pos;} int length()const {re原创 2013-10-17 15:20:59 · 595 阅读 · 0 评论 -
1053. Path of Equal Weight——深搜
方便输出的一点操作:将子节点根据weight来排序,这样遍历到符合要求的路径就可以直接输出! #include#include#include#includeusing namespace std;const int maxn=105;int n,m,s;class node{public: int cnt,flag; int son[maxn];};nod原创 2013-10-03 17:02:18 · 924 阅读 · 0 评论 -
Tcl的学习
由于项目需要,快速过了一遍Tcl脚本语言基础。 set x 10; set y x+100 ; # y= x+100 set y $x+100 #变量置换 $ y=10+100 set y [expr $x+100] #命令置换 [] y=110 [把expr当做命令名 [] 中脚本的值为最后一个命令的返回值 expr将 $+100 参数做表达式处理set msg m原创 2013-08-08 14:26:21 · 1391 阅读 · 0 评论 -
C++学习之static(二)
#includeusing namespace std;/*--------------------static 学习-------*/int x=100;class withStatic { int i; static int x; static int y;public: void print() const { cout<<"x= : "<<x<<endl; c原创 2013-07-01 14:19:13 · 679 阅读 · 0 评论 -
C++学习之static(一)
#includeusing namespace std;/*--------------------static 学习-------*/char onechar(const char * charArray=0){ static const char *s;// ----------------1,只初始化一次 if(charArray) { s=charArray; r原创 2013-07-01 11:11:05 · 542 阅读 · 0 评论 -
C++学习之const常量
#include#includeusing namespace std;//const int * const w()//{// static int i;// return &i;//}/* ------------------------------------------------------------ 5,声明一个“成员函数”为const,则等于告诉编原创 2013-06-30 15:50:46 · 703 阅读 · 0 评论 -
创建Time 对象
创建2个Time对象,执行两for循环,显示时间延缓!Time类://:C09:Cpptime.h//A simple time class#ifndef CPPTIME_H#define CPPTIME_H#include#includeclass Time{ std::time_t t; std::tm local; char asciiRep[27]; uns原创 2013-06-29 15:51:40 · 782 阅读 · 0 评论 -
贪吃蛇游戏
模仿http://zhidao.baidu.com/link?url=73YIrvyI57-_a7ur1H2rK1xjdK8oeTnUu28z6bL0hD28HOaLeeRoEYCh3p2YRTrKM0NP20atWAdFhnOklpMGn_#include#include#include#include#includeusing namespace std;#define N原创 2014-03-15 21:49:03 · 837 阅读 · 0 评论