c++学习-链表
摘要:静态链表:#include#includeusing namespace std;struct book{ int num; float price; struct book *next;};int main(){ book x, y, z, *head, *p; x ...
阅读全文
posted @
2015-06-28 12:55
思齐_
阅读(250)
推荐(0) 编辑
c++学习-字符串
摘要:字符数组和 string类型比较的区别#include#includeusing namespace std;class area{public: area(){ cout i = i; cout w = w; this->h = h; cout w = w; this->h =...
阅读全文
posted @
2015-06-27 14:57
思齐_
阅读(470)
推荐(0) 编辑
c++学习-数组
摘要:int a[10]; //是个元素,在windows下回报错,linux会输出一个随机数int a[10]={1,2}; //初始化,其他的为0数组越界:为了调高效率, 编译器不会对数组越界做检查#include using namespace std;int main(){ int ...
阅读全文
posted @
2015-06-21 23:07
思齐_
阅读(462)
推荐(0) 编辑
c++学习-虚函数
摘要:#include using namespace std;class common{public: virtual void hello(){couthello(); return 0;}静态联编:在编译时就确定指针指向的类#include using namespace std;cla...
阅读全文
posted @
2015-06-21 15:21
思齐_
阅读(224)
推荐(0) 编辑
c++学习-继承
摘要:继承#include using namespace std;class father{public: void getHeight(){coutweightheightageusing namespace std;class father{public: int height;};cl...
阅读全文
posted @
2015-06-21 12:32
思齐_
阅读(225)
推荐(0) 编辑
c++学习-运算符重载
摘要:重载=号运算符,由于成员属性中有指针会出现错误#include using namespace std;class num{public: num(){n=new int;*n=1;coutx=a.x;cout two.operator =(one); coutusing nam...
阅读全文
posted @
2015-06-20 23:02
思齐_
阅读(275)
推荐(0) 编辑
c++学习
摘要:#includeint main(){ std::cout>sjk; std::cout//using std::cout;//using std::endl;using namespace std;int main(){ cout//using namespace std;nam...
阅读全文
posted @
2015-06-13 23:50
思齐_
阅读(720)
推荐(0) 编辑