自定义博客皮肤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)
  • 收藏
  • 关注

原创 个人笔记

#include#includeusing namespace std;void f(int n){ int i,j=0,sum=n;  int a[10]={0};   while(n>0)      {           a[j]=n%10;j++;n=n/10;   }    if(a[0]==a[1]||a[0]==a[2]||a[

2016-09-12 20:59:05 195

转载 虚函数

#includeusing namespace std;class Student{public:Student(int ag,char se){age=ag;sex=se;}virtual void display(){ cout}protected:int age;char sex;};class Gradua

2016-09-07 17:04:59 195

转载 虚基态程序

#include #includeusing namespace std;class Person{public:Person(string nam,char s,int a){name=nam;     sex=s;age=a;}protected:    string name;char sex;int age;};//声明Person的

2016-08-30 22:15:01 294

原创 继承类的访问属性的小程序

#include #includeusing namespace std;class student{public:student(string n,int a){name=n;     age=a;}void display();protected:    string name;int age;};void student::disp

2016-08-30 15:50:09 277

原创 运算符重载

c++ 中 * 重载1,运算符重载函数作为类成员函数:#include using namespace std;class complex1{public:complex1(){real=0;imag=0;}complex1(int r,int i);void display();complex1 operator*(complex1 &c);priva

2016-08-29 11:03:30 314

转载 以++运算符为例,介绍单目运算符的重载

#includeusing namespace std;class Time{public:    Time(){minute=0;sec=0;}Time(int m,int s):minute(m),sec(s){}    Time operator++();void display(){coutprivate:int minute;int sec

2016-08-27 16:43:33 441

转载 关于运算符重载(总结)

关于运算符重载(总结)1、运算符重载是为了对用户自定义数据类型的数据的操作与内定义的数据类型的数据的操作形式一致。不能重载的5个运算符:*成员指针访问运算符;::域运算符;sizeof长度运算符;?:条件运算符;.成员访问符。运算重载的三种方式:普通函数,友元函数,类成员函数。当重载为成员函数时,双目运算符仅有一个参数。对单目运算符,重载为成员函数时,不能再显式说明参数

2016-08-27 11:54:35 440

原创 复数相加小程序

#include using namespace std;class complex{public:void display();complex(int,int);~complex(){}    int real;int imag;};complex::complex(int r,int ima){ real=r; imag=ima;}

2016-08-26 10:54:18 379

原创 几个小程序 O(∩_∩)O~

1,#includeusing namespace std;int main(){char*s="AAA";printf("%s",s);s[0]='B';printf("%s",s);return 0;}输出为AAA 第二个不能输出 因为s是指向字符串的指针,不能被赋值。若是想赋值可以改成如下:#includeusing namespace s

2016-08-24 11:49:44 281

原创 指向常对象的指针变量和指向对象的常指针

指向常对象的指针变量和指向对象的常指针1,指向常对象的指针变量指向常对象的指针变量可以指向一个已经申明为常对象的变量,此时只能用指向常对象的指针变量指向它;也可以指向一个非常对象的变量,而此时可通过指针访问该对象,但是不能通过指针改变该对象的值。下面给出一个简单程序:#include using namespace std;class Student{    publi

2016-08-23 21:22:56 3195

空空如也

空空如也

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

TA关注的人

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