如何在 C++ 中的类中创建动态二维数组
这里是一个简单的C++程序,用于在类中创建一个动态2D数组来打印数组的元素。
算法
Begin Create a class Arr and declare size of array. Inside the class, initialize all the elements by using for loop. Print the all elements. End.
示例代码
#include#include using namespace std; const int M=7; class Arr { private: int A[M]; int size; public: Arr(int s, int v) { if(s>M) { cout< = size) ) { cout< 输出结果 数组元素是: 0 10 20 30 40 50 60
热门推荐
10 新人红包祝福语简短精辟
11 幼师给毕业祝福语简短
12 生日高考祝福语妹妹简短
13 下飞机祝福语简短英文
14 元宵发客户祝福语简短
15 爸妈金婚文案祝福语简短
16 新郎朋友红包祝福语简短
17 虎年五一祝福语大全简短
18 出阁宴祝福语姐姐简短