- 博客(10)
- 收藏
- 关注
原创 8.16
#include #include using namespace std; template class Array{ public: Array(Type* d,int i) { data=d; n=i; } ~Array(){ } void sort(); //从大到小排序 void Reverse();
2015-07-09 16:05:59 279
原创 8.15
#include using namespace std; template T max(T a[],int n) //定义函数模板max { int i; T max=a[0]; for(i=1;i<n;i++) if(max<a[i]) max=a[i]; return max; } template T min(T a[],int n) //定义函数
2015-07-09 16:04:49 262
原创 7.12
#include using namespace std; class Container{ public: Container(double r=0,double i=0); friend Container operator+(const Container c1,const Container c2); void print() ; private:
2015-07-09 16:03:01 231
原创 7.11
#include #include using namespace std; class Time{ public: Time(int h=0,int m=0,int s=0); //构造函数 Time operator+(Time&); //运算符重载函数 void disptime(string); //输出时间函数
2015-07-09 16:01:39 324
原创 6.13~6.14
6.13 #include using namespace std; class Base{ public: Base(double h1) {h=h1;} virtual void disp() {} protected: double h; }; class Cuboid :public Base{ public: Cub
2015-07-09 15:43:58 236
原创 5.18~5.19
5.18 #include #include using namespace std; class person { public: person(string a,string b) { name=a; num=b; } void Getterab() { cout<<"name:"<<name<<" "<<"num:"<<num<<" "; } private:
2015-06-29 20:56:55 240
原创 4.17~4.22
4.17 #include using namespace std; class Student { public: void setstu(int num,float s) {number=num;score=s;} void disp() {cout<<number<<" "<<score<<endl;} private: int number; float score;
2015-06-29 20:41:21 400
原创 作业3.23
#include using namespace std; class cylinder{ private: double r; double h; public: cylinder(double x,double y) { cout<<"construting..."<<endl; r=x; h=y; } ~cylinder() { cout<<"destructing
2015-04-01 19:04:42 280 1
原创 作业3.22
#include using namespace std; class circle{ public: float area(); circle(); circle(float r); public: float radius; }; circle::circle() { radius=1.0; } circle::circle(float r
2015-04-01 19:03:28 321 1
原创 作业1
(习题2.29) #include using namespace std; const int a=20; int main() { int i; int *p; p=new int[a]; p[0]=1; p[1]=1; for(i=2;i<a;i++) p[i]=p[i-1]+p[i-2]; cout<<"Fibona
2015-03-26 13:58:45 291 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人