用C++语言编写程序
定义一个方阵类Array,实现对方阵进行顺时针90度旋转。如图所示。
|1 2 3 4 | |13 9 5 1 |
|5 6 7 8 | → |14 10 6 2 |
|9 10 11 12 | |15 11 7 3 |
|13 14 15 16 | |16 12 8 4 |
具体要求如下:
(1)私有数据成员
int a[4][4]:用于存放方阵。
(2)公有数据成员
Array(int a1[][4],int n):构造函数,用给定的参数a1初始化数据成员a。
void xuanzhaun():实现对方阵a进行顺时针90度的旋转。
void show():在屏幕上显示数组元素。
(3)在主程序中定义数组int b[][4]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}对作为原始数组。定义一个类Array类对象test,用b初始化test,完成对该类的测试
编好后程序 一定请发610449128@qq.com~谢了