计算器类升级版

#include "stdafx.h"#include<iostream>#include<string>#include<sstream>using namespace std;class Computer{ double result;//保存运算结果 istringstream expr; //保存表达示 int paren; /*'(' paren加1,')'paren减1。一旦paren为负时就肯定是输入有错,运算全部结束后其值不为零也是出错。可以增加一个小类来做为paren的类型*/protected: int getSign();//...
默认分类 | 2011-04-24 09:03 | 阅读 1580 次 | 评论 1 条

红黑树的实现

//Rbtree.h#ifndef RBTREE#define RETREEtypedef int type;class Rbtree{ enum COLOR{RED,BLACK}; typedef struct Node { Node(); Node(type k); /*Node(const Node&amp;);*/ void* operator new(size_t size) { static int p = 0; static...
默认分类 | 2011-04-20 15:09 | 阅读 1334 次 | 评论 0 条

一个简单的计算器类

#include<iostream>#include<string>using namespace std;class Computer{ double result;//保存运算结果 int index; //保存expr的下标,index只会增大或者不变,不可能减少 string expr; //保存表达示 int paren; /*'(' paren加1,')'paren减1。一旦paren为负时就肯定是输入有错,运算全部结束后其值不为零也是出错。可以增加一个小类来做为paren的类型*/protected: char getSign...
默认分类 | 2011-04-17 16:46 | 阅读 1492 次 | 评论 0 条
浏览30055次