20141030
来源:互联网 发布:数据库安全的重要性 编辑:程序博客网 时间:2024/06/16 08:24
#include <iostream>#include <string>using namespace std;//typedef int Tclass A{int* a;int len;public:A(int n, int x=0):a(new int[n]){int i = 0;for(i=0; i<n; i++){a[i] = x;}len = n;cout << "creating array " << len << "ge" << x << endl;}~A(){cout << "deleting array" << endl;delete[] a;a = NULL;}void resize(int newsize, const int& val=int()){if(newsize <= len)len = newsize;else{int* na = new int[newsize];for(int i=0; i<len; i++)na[i] = a[i];for(int j=len; j<newsize; j++)na[j] = val;delete[] a;a = na;len = newsize;}}void print(){for(int i=0; i<len; i++)cout << a[i] << " ";cout << endl;}};int main(){A a(20,1);a.resize(25,5);a.print();}
0 0
- 20141030
- 20141030 N2
- 20141030业务
- 20141030 N2
- hdoj.1176 免费馅饼 20141030
- hdoj.1215 七夕节 20141030
- 日语学习之沪江整理 20141030
- 英语学习之沪江整理 20141030
- 一切成功源于积累——20141030 美联储纪要 风险警示
- 在Android应用中实现查看“附近的人”的功能
- selector无法改变tablehost中的图片
- 高并发-线程安全处理(1)-可变整数类之代码详解
- 如何在Maven中加入依赖
- Deep Learning(深度学习)学习笔记整理系列之(一)
- 20141030
- Deep Learning(深度学习)学习笔记整理系列之(二)
- Android轻量级数据保存方式
- 简单环形队列实现
- 其中的LinearLayout使用了
- UVa 11063 - B2-Sequence
- JAVA程序设计(11)-----面对对象初级设计 麻将 创建麻将牌 然后洗牌 发牌~ 恩 就这样
- 看别人写的一个多文件下载类
- Win7_64位_QT5.3.2_CMake2.8.12_OpenCV2.3.1