自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 问答 (1)
  • 收藏
  • 关注

原创 graphl.h

#ifndef GRAPHL_H#define GRAPHl_H#include #include "graph.h"using namespace std;// node data elementstruct listUnit { int vertex; // 顶点 int weight; // 边的权};// linked li

2015-07-26 19:44:18 454

原创 graphm.h

/* 1. 二维数组存储边的权值, 权为零表示边不存在 */#ifndef GRAPHM_H#define GRAPHM_H#include #include "graph.h"using namespace std;class Graphm : public Graph {private: int **matrix;public: Graphm(int numVe

2015-07-26 19:42:09 343

原创 graph.h

#ifndef GRAPH_H#define GRAPH_H#include #include using namespace std;const int UNVISITED = 0;const int VISITED = 1;class Edge {public: int from; //edge start point int to; //edge end p

2015-07-26 19:40:00 1564

原创 arrlist

/* 1. 插入删除等位置参数指数组下标 * 2. 判断条件有:表是否已满; 位置是否合法 */#ifndef LIST_H#define LIST_H#include using namespace std;template class arrList {private: T* aList; int maxSize; int curLen; int positio

2015-07-22 21:59:42 506

原创 lnklist

/* 1. head->next第一个元素, 位置为0 * 2. setPos(-1) return head * 3. 删除和插入先定位到前一个结点 * 4. 尾结点为临界情况,需要特殊处理 */#ifndef LNKLIST_H#define LNKLIST_H#include using namespace std;templateclass Node {publ

2015-07-22 21:55:05 351

原创 cout.get() P494

#include #include using namespace std;int main () { char ch; while ( ( ch = cin.get() ) != EOF) cout.put(ch); return 0;}

2015-06-06 23:17:42 480

原创 输入输出--数值转换为字符串

#include #include #include using namespace std;templateinline string toString(const T &v) { ostringstream os; os<<v; return os.str();}int main() { string str1 = toString(5); cout<<str1<<

2015-06-06 22:51:19 480

原创 输入输出--write

#include using namespace std;struct Date { int mondy, day, year;};int main() { Date dt = {7, 27, 93}; ofstream file("date.dat", ios_base::binary); file.write(reinterpret_cast(&dt), sizeof(d

2015-06-06 22:41:22 351

原创 输入输出控制

#include #include #include using namespace std;int main() { int values[] = {111, 123, 653, 43584}; string names[] = {"Zoot", "Jimmy", "Al", "Stan"}; cout<<setiosflags(ios_base::fixed); for(

2015-06-06 21:55:05 424

原创 流类库与输入输出--精度

#include #include #include using namespace std;int main() { double values[] = {1.23, 35.36, 653.7, 4358.24}; string names[] = {"Zoot", "Jimmy", "Al", "Stan"}; for(int i = 0; i < 4; i++) co

2015-06-06 21:42:56 357

原创 流类库与输入输出--对齐方式

#include #include #include using namespace std;int main() { double values[] = {1.23, 35.36, 653.7, 4358.24}; string names[] = {"Zoot", "Jimmy", "Al", "Stan"}; for(int i = 0; i < 4; i++) co

2015-06-06 21:40:37 367

原创 palindrome number

#include using namespace std;bool pail(unsigned n) { unsigned i = n; unsigned m = 0; while(i > 0) { m = m*10+i%10; i /= 10; } return m == n;}int main() { unsigned m=0; do { cou

2015-06-06 00:45:21 273

原创 类模板(函数模板)

#include using namespace std;templateT abs(T x) { return x < 0?-x:x;}int main() { int n = -5; double d = -5.5; cout<<abs(n)<<endl; cout<<abs(d)<<endl; return 0;}

2015-06-01 20:56:18 204

原创 Visitor Pattern -- 基于编译试验抽象语法树 (C++)

1. Visitor.h#ifndef VISITOR_H#define VISITOR_Hclass Visitor;class Node{public: virtual void Accept(Visitor &v) = 0;};class Exp : public Node {};class Unary : public Exp

2015-05-31 22:13:39 634

原创 Tower of Hanoi (递归的神奇之力--化繁为简)

/* *Tower of Hanoi* */#include using namespace std;void move(char s, char d) { cout"<<d<<endl;}/* s is source tower, d is target tower m is middle tower, n id the number of diskes */ void

2015-05-31 22:05:10 411

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除