文件名称:1
介绍说明--下载内容均来自于网络,请自行研究使用
定义数组MyArray类。它满足的要求如下:1。该类用于保存整数;2。类可以检查数组下标溢出;3。客户端可以使用您定义为MyArray的主要代码:无效的main(){MyArray intarray(10);//这里10是intarray的元素的数目。对于(int i = 0;i < 10;i++)intarray [我] =我*我;//初始化intarray的元素cout << intarray;/ /打印中的每一个元素intarray}4。这是额外的需求:思考如何保存任何数据而不是整数。-Define array class: MyArray. It s satisfied with demands as follows:
1. The class is used to save integer
2. The class can check array subscr ipting overflow
3. The client can use MyArray you define like as following codes in the main:
void main()
{
MyArray intArray(10) // Here 10 is the number of intArray s elements.
for (int i=0 i<10 i++)
intArray[i] = i* i // Initialize the intArray s elements
cout << intArray // Print every element in the intArray
}
4. Here is additional demand: think over how to save any data rather than integer.
1. The class is used to save integer
2. The class can check array subscr ipting overflow
3. The client can use MyArray you define like as following codes in the main:
void main()
{
MyArray intArray(10) // Here 10 is the number of intArray s elements.
for (int i=0 i<10 i++)
intArray[i] = i* i // Initialize the intArray s elements
cout << intArray // Print every element in the intArray
}
4. Here is additional demand: think over how to save any data rather than integer.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
1.cpp