随笔 - 307  文章 - 0  评论 - 30  阅读 - 79万
09 2012 档案
c++金字塔程序
摘要:#include <cstdlib>#include <iostream>using namespace std;#define MAXLEN 40void printline(int i){//i用来指示当前行剩余钻石的个数 char cstr[MAXLEN] = {0}; memset(cstr, '\0', MAXLEN); int mid = MAXLEN / 2; int j, k; //初始化,根据奇偶决定是否打印第一行 if (i % 2 != 0) { cstr[mid] = '*'; ... 阅读全文
posted @ 2012-09-24 21:40 kkmm 阅读(3983) 评论(0) 推荐(0) 编辑
关于为什么在有继承关系的类结构中,析构函数destructor要是virtual以及如果不是会发生什么
摘要:#include <iostream> using namespace std; class Base { public: Base(){cout<<"Base constructor"<<endl;} ~Base(){cout<<"Base dectructor"<<endl;} }; class Derived : public Base { public: Derived(){cout<<"Derived constructor"<<endl;} 阅读全文
posted @ 2012-09-13 17:51 kkmm 阅读(863) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示