cs11_c++_lab6】的更多相关文章

expressions.hh #ifndef EXPRESSIONS_HH #define EXPRESSIONS_HH #include "environment.hh" #include <string> #include <stdexcept> #include <cassert> #include <cmath> using namespace std; class Expression { public: Expression(…
wcount.cc #include <iostream> #include <map> #include <string> #include <algorithm> #include <ctype.h> // So we don't have to type "std::" everywhere... using namespace std; string processWord(string &word); voi…
heap.hh #ifndef HEAP_HH #define HEAP_HH #include <iostream> #include <stdexcept> #include <cassert> using namespace std; template <typename T, int maxsize>class heap//模板类heap,类型T,常量maxsize { private: int num_values;//当前存储的元素的数量 T v…
SparseVector.hh class SparseVector { private: //结构体不一定会用到,不用初始化 struct node { int index; int value; node *next; node() : index(index), value(value), next(next) {} }; //这些才是真正的数据成员,要初始化的 int size; node *start; void clear(); void copyList(const SparseV…
SparseVector.hh class SparseVector { private: //结构体不一定会用到,不用初始化 struct node { int index; int value; node *next; node() : index(index), value(value), next(next) {} }; //这些才是真正的数据成员,要初始化的 int size; node *start; void clear(); void copyList(const SparseV…
Matrix.hh class Matrix { int row; int col; int *p; void copy(const Matrix &m); void clearup(); public: Matrix(); Matrix(int x,int y); ~Matrix(); Matrix(const Matrix &m); const int getrows() const; const int getcols() const; void setelem(int x,int…
Matrix.hh class Matrix { int row; int col; int *p; public: Matrix(); Matrix(int x,int y); ~Matrix(); Matrix(Matrix &m); int getrows(); int getcols(); void setelem(int x,int y,int elem); int getelem(int x,int y); void add(Matrix &m); void subtract(…
lab1.cpp #include "Point.hh" #include <iostream> #include <cmath> using namespace std; double computeArea(Point &a, Point &b, Point &c) { double x=a.distanceTo(b); double y=b.distanceTo(c); double z=c.distanceTo(a); ; dou…