将一个4X4的数组进行逆时针旋转90度后输出,要求原数 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【meiwen.anslib.com - 电脑资料】

   

//将一个4X4的数组进行逆时针旋转90度后输出,要求原数组数据随机输入#include<stdio.h>int main(){	int a[4][4],b[4][4],i,j;//a存放原是数组数据,b存放旋转后的数组数据	printf(please input 16 number:);	for(i=0;i<4;i++)		for(j=0;j<4;j++)		{			scanf(%d,&a[i][j]);			b[3-j][i]=a[i][j];		}	printf(array b:);	for(i=0;i<4;i++)	{		for(j=0;j<4;j++)			printf(%6d,b[i][j]);			printf();	}	return 0;}</stdio.h>
please input 16 number:1 2 3 4 5 6 7 8 9 10 23 3 4 6 7 23array b:     4     8     3    23     3     7    23     7     2     6    10     6     1     5     9     4Press any key to continue

最新文章