自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 编写一个类,该类具有统计文件长度,实现文件复制的函数。   其中复制功能函数如:   void copy(string srcFileName,string targetFileName);

#include#includeusing namespace std;class copystrlen{public:void copy(string srcFileName,string targetFileName);private:char ch;}; void copystrlen::copy(string srcFileName,string t

2013-12-08 18:29:45 981

原创 对数组进行排序、求最大值和求元素和的算法都编写为函数模板,采用相关数据进行测试。

#includeusing namespace std;templateT Max(T elem[],int size){   T max=elem[0];for(int i=1;i{if(maxmax=elem[i];}return max;} template T Sum(T elem[],int size){      T su

2013-12-08 18:28:34 1706

原创 6.对数组进行排序、求最大值和求元素和的函数采用静态成员函数的方式封装成数组算法类模板ArrayAlg,并采用相关数据进行测试。

#includeusing namespace std;templateclass ArrayAlg{private:T *elem;int size;public:ArrayAlg(int a[],int s):elem(a),size(s){}static T Max(T elem[],int size);static T Sum(T elem[],in

2013-12-08 18:27:07 3272 3

原创 编写一个使用数组类模板Array对数组进行排序、求最大值和求元素和的程序,并采用相关数据进行测试。

#includeusing namespace std;templateclass Array{private:T *elem;int size;public:Array(int a[],int s):elem(a),size(s){}T Max();T Sum();void Sort();void Display();}; templa

2013-12-08 18:25:40 9538 2

原创 用抽象类设计计算二维图形面积的程序,在基类TDshape中设计纯虚函数area()和printName().are()用于计算图形的几何面积,printName()用于打印输出几何图形的类名

#includeusing namespace std;class TDshape{protected:double Width,Heigth;public:void set(double a,double b) {Width=a;Heigth=b;};virtual double area()=0;virtual void printName()=0;};

2013-12-02 23:51:23 3195 1

原创 设计一个计算器类Calculator,它只有一个计数的成员count。该计算器的有效范围说0~65535,实现计算器的前自增、后自增、前自减、后自减、两个计算器相加减等运算

#includeusing std::cout;using std::endl; class Calculator{  private:      double count;  public:      Calculator(double a):count(a){};      double getcount(){          return count;

2013-12-02 23:44:12 5763

原创 设计一个时间类Time,要求: (1)包含时(hour)、分(minute)和秒(second)私有数据成员。 (2)包含构造函数,重载关于一时间加上另一时间的加法运算符+、重载关于一时间减去另一时间

#includeusing namespace std;class Time{private:int hour;int minute;int second;public:Time();Time(int h, int m ,int s);Time operator+(Time &t);Time operator-(Time &t);Time ope

2013-12-02 23:38:27 44756 5

原创 设计一个日期类Date,,要求: (1)包含年(year)、月(month)和日(day)私有数据成员。 (2)包含构造函数,重载关于一日期加上天数的加法运算符+、重载关于一日期减去天数的减加运算符-

#includeusing namespace std;class Date{private:int year,month,day;public:Date(int y=1,int m=1 ,int d=1){year=y;month=m;day=d;}int GetYear() const {return year;}int GetMonth() c

2013-12-02 23:37:26 29599 3

原创 定义一个描述学生(Student)基本情况的类,数据成员包括姓名(name)、学号(num)、数学成绩(mathScore)、英语成绩(englishScore)、人数(count)、数学总成绩(ma

#includeusing namespace std;class Student{char *name;int number;int mathScore;int englishScore;static int num;static int mathTotalScore;static int englishTotalScore;public:Studen

2013-12-02 23:35:53 14647

原创 编写设计一个People(人)类。该类的数据成员有年龄(age)、身高(height)、体重(weight)和人数(num),其中人数为静态数据成员,成员函数有构造函数(People)、进食(Eatt

#includeusing namespace std;class People{protected:int age;double height;double weight;static int num;public:People(int a ,double h,double w){age=a;height=h;weight=w;num++;}

2013-12-02 23:34:48 4573

空空如也

空空如也

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

TA关注的人

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