自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 第二题

#include #include using namespace std; class Student  {public:    Student(int n,string nam)      {cout      num=n;name=nam;}    ~Student(){cout    void get_data(); private:    int num;  

2015-06-22 18:51:35 259

原创 第一题

#include #include using namespace std; double q(double,double,double); int main() {double a,b,c,p,x1,x2;  cout  cin>>a>>b>>c;  p=-b/(2*a);  try   {x1=p+q(a,b,c);    x2=p-q(a,b,c);    cou

2015-06-22 18:50:27 231

原创 第六题

#include #include using namespace std; struct student {int num;  char name[20];  double score; }; int main() {student stud[3]={1001,"Li",78,1002,"Wang",89.5,1004,"Fun",90},stud1[3];  c

2015-06-22 18:46:46 257

原创 第五题

#include #include using namespace std; struct staff {int num;  char name[20];  int age;  double  pay; }; int main() {staff staf[7]={2101,"Li",34,1203,2104,"Wang",23,674.5,2108,"Fun",54,778

2015-06-22 18:44:44 355

原创 第三题

#include #include using namespace std; int main() {  for(int n=1;n  cout  return 0; }

2015-06-22 18:41:40 192

原创 第二题

#include using namespace std; int main() {float a[5];  inti;  cout  for(i=0;i  cin>>a[i];  cout.setf(ios::fixed);  cout.precision(2);  for(i=0;i  {cout.width(10);   cout  return 0; }

2015-06-22 18:39:43 193

原创 第一题

#include #include using namespace std; int main() {double a,b,c,s,area;  cout  cin>>a>>b>>c;  if (a+b   cerr  else if(b+c   cerr  else if (c+a   cerr  else   {s=(a+b+c)/2;    area=sqr

2015-06-22 18:38:07 187

原创 第五题

#include using namespace std; //定义抽象基类Shape class Shape {public:  virtual double area() const =0;                                //纯虚函数 }; //定义Circle(圆形)类 class Circle:public Shape {publ

2015-06-22 18:34:58 179

原创 第四题

#include using namespace std; //定义抽象基类Shape class Shape {public:  virtual double area() const =0;            //纯虚函数 }; //定义Circle类 class Circle:public Shape {public: Circle(double r):ra

2015-06-22 18:33:07 311

原创 第三题

#include using namespace std; class Point {public:   Point(float a,float b):x(a),y(b){}   ~Point(){cout  private:   float x;   float y; }; class Circle:public Point {public:  Circ

2015-06-22 18:29:23 195

原创 第十题

#include #include using namespace std; class Teacher                                //教师类  {public:   Teacher(int,char [],char);               //声明构造函数     void display();                    

2015-06-16 17:54:36 217

原创 第九题

#include #include using namespace std; class Teacher  {public:    Teacher(string nam,int a,char s,string tit,string ad,string t);    void display();   protected:     string name;     int age

2015-06-16 17:26:26 172

原创 第八题

#include using namespace std; class A  {   public:    A(){cout    ~A(){cout  }; class B  : public A  {   public:    B(){cout    ~B(){cout }; class C  : public B  {   public:

2015-06-16 17:25:17 248

原创 第七题

#include using namespace std; class A  {   public:    A(){a=0;b=0;}    A(int i){a=i;b=0;}    A(int i,int j){a=i;b=j;}    void display(){cout   private:    int a;    int b;  }; class

2015-06-16 17:23:45 240

原创 第四题

#include using namespace std; class Student//声明基类 {public:                             //基类公用成员   void get_value();   void display( );  protected :                         //基类保护成员     int num

2015-06-16 17:18:51 323

原创 第三题

#include using namespace std; class Student                        //声明基类 {public:                             //基类公用成员   void get_value();   void display( );  protected :                      

2015-06-16 17:16:19 194

原创 第二题

#include using namespace std; class Student {public:   void get_value()    {cin>>num>>name>>sex;}   void display( )     {cout      cout      cout  private :    int num;    char name[10];

2015-06-16 17:12:52 226

原创 第一题

#include using namespace std; class Student {public:   void get_value()    {cin>>num>>name>>sex;}   void display( )     {cout      cout      cout  private :    int num;    char name[10];

2015-06-16 17:10:18 219

原创 5.19晚课堂作业

//扩展程序:创建一个三角形类 //修改create_object函数,使得程序支持三角形的创建 //和求面积、打印等操作 #include  #include  using namespace std;   class Shape { public: virtual double getArea() const =0; virtual void print() const 

2015-05-19 22:47:08 202

原创 第七题

#include using namespace std; class Student {public: Student(int,char[],char,float);   int get_num(){return num;}   char * get_name(){return name;}   char get_sex(){return sex;}   void displa

2015-04-27 21:49:01 199

原创 第六题

#include using namespace std; class Complex  {public:    Complex(){real=0;imag=0;}    Complex(double r){real=r;imag=0;}    Complex(double r,double i){real=r;imag=i;}    operator double(){retur

2015-04-27 21:47:47 225

原创 第五题

#include //using namespace std; class Matrix  {public:    Matrix();    friend Matrix operator+(Matrix &,Matrix &);    friend ostream& operator    friend istream& operator>>(istream&,Matrix&);

2015-04-27 21:47:44 304 1

原创 第四题

#include  using namespace std; class Matrix                                          //定义Matrix类  {public: Matrix();                                          //默认构造函数    friend Matrix operator+(M

2015-04-27 21:46:05 191

原创 第三题

#include        class Complex  {public:    Complex(){real=0;imag=0;}    Complex(double r,double i){real=r;imag=i;}    Complex operator+(Complex &c2);    Complex operator+(int &i);    friend Co

2015-04-27 21:43:47 153

原创 第二题

#include using namespace std; class Complex  {public:    Complex(){real=0;imag=0;}    Complex(double r,double i){real=r;imag=i;}    Complex operator+(Complex &c2);    Complex operator-(Complex

2015-04-27 21:41:15 191

原创 第一题

#include using namespace std; class Complex  {public:    Complex(){real=0;imag=0;}    Complex(double r,double i){real=r;imag=i;}    double get_real();    double get_imag();    void display();

2015-04-27 21:40:05 193

原创 第十二题

#include using namespace std; template class Compare  {public:    Compare(numtype a,numtype b);    numtype max();    numtype min();   private:    numtype x,y;  }; template Compare::Compa

2015-04-27 21:37:16 227

原创 第十一题

#include using namespace std; class Time; class Date  {public:    Date(int,int,int);    friend Time; private:    int month;    int day;    int year;  }; Date::Date(int m,int d,int y):

2015-04-27 21:35:31 214

原创 第十题

#include using namespace std; class Date; class Time  {public:    Time(int,int,int);    friend void display(const Date &,const Time &);   private:    int hour;    int minute;    int sec;  

2015-04-27 21:32:06 207

原创 第九题

#include using namespace std; class Product  {public:    Product(int n,int q,float p):num(n),quantity(q),price(p){};    void total();    static float average();    static void display();

2015-04-27 21:29:28 213

原创 第八题

#include using namespace std; class Student  {public:    Student(int n,float s):num(n),score(s){}    void change(int n,float s) {num=n;score=s;}    void display() {cout   private:    int num;

2015-04-27 21:27:50 224

原创 第七题

#include using namespace std; class Student  {public:    Student(int n,float s):num(n),score(s){}    void change(int n,float s) const  {num=n;score=s;}    void display() const {cout   private:

2015-04-27 21:25:59 193

原创 第五题

#include using namespace std; class Student  {public:    Student(int n,float s):num(n),score(s){}    int num;    float score;  }; void main() {Student stud[5]={   Student(101,78),Studen

2015-04-27 18:01:36 272

原创 第四题

#include using namespace std; class Student  {public:    Student(int n,float s):num(n),score(s){}    void display();   private:    int num;    float score;  }; void Student::display()

2015-04-27 17:58:46 149

原创 第三题

第三题源代码 #include using namespace std; class Date  {public:    Date(int=1,int=1,int=2005);    void display();   private:    int month;    int day;    int year;  }; Date::Date(int m,int

2015-04-27 17:57:16 192

原创 第二章

2,改写本章例2.1程序,要求: (1)将数据成员改为私有; (2)将输入和输出的功能改为由成员函数实现; (3)在类体内定义成员函数; #include  using namespace std; class Time { private: int hour; int minute; int sec; public: void sl() { cin>>hour;

2015-03-31 10:53:02 1606

原创 第一章

7,求2个或3个正整数的最大数,用带有参数的函数实现。 #include  using namespace std; int main() { int max(int a , int b,int c=0); int a,b,c,i,max; cout您需要比较几位数的大小?(2-3)位" cin>>i; cout请输入"个数" if(i==2) cin>>a>>b; if(

2015-03-31 10:44:14 425

空空如也

空空如也

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

TA关注的人

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