自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 函数模板的使用

#include<iostream>#include<conio.h>using namespace std;template<class T>T min(T a[],int n){int i;T minv=a[0];for(i=1;i<n;i++) if(minv>a[i]) minv=a[i];return minv;}void main(){int a[]={1,3,0,2,7,6,4,5,2};double b...

2021-12-22 17:00:35 375

原创 复数的乘法(通过运算符重载实现)

#include<iostream>#include<conio.h>using namespace std;class Complex {public:double real;double imag;Complex(double r = 0, double i = 0){real = r;imag = i;}void print();friend Complex operator*(Complex co1, C...

2021-12-19 12:12:06 729

原创 派生类与继承下的构造函数与析构函数

#include<iostream>#include<string>#include<conio.h>using namespace std;class MyArray{public:MyArray(int length);~MyArray();void Input();void Display(string);protected:int *alist;int length;};MyArray::MyArray(in

2021-12-13 00:28:01 935

原创 派生类与继承

#include<iostream>#include<conio.h>using namespace std;class Base {public:void setx(int i){x = i;}int getx(){return x;}public:int x;};class Derived :public Base {public:void sety(int i){y = i;}int get

2021-12-13 00:22:17 676

原创 类与对象,对象传递,静态成员

Part A# include<iostream>using namespace std;class Tr{public :Tr(int n){i = n;}void set_i(int n){ i= n;}int get_i(){return i;}private:int i;};void sqr_it(Tr ob) l/对象ob作为函数sqr_it的形参{ ob.set_i(ob.get_i()*ob.get_i());cou.

2021-11-28 21:28:36 113

原创 输入学生成绩,计算总成绩,个人平均成绩和单科平均成绩

#include<iostream>#include<string>#include<stdlib.h>using namespace std;class Score{public: Score() { renshu=2; } Score(int renshu1) { renshu=renshu1; } void InputCoord() { for(int...

2021-11-22 09:38:26 1755

原创 C++类与对象,构造函数与析构函数的使用

#includeusing namespace std;class Coordinate {public:Coordinate(){times = 2;cout << “Coordinate construction1 called!” << endl;}Coordinate(int times1){times = times1;cout << “Coordinate construction2 called!” << endl;}

2021-11-15 08:29:42 825

空空如也

空空如也

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

TA关注的人

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