/* Copyright (c) 2014, Yantai University School of Computer * All rights reserved. * File name: Test.cpp * Chen Dani * Completion date: November 30, 2014 * Version number: v1.0 * * Problem Description: No * Input Description: Enter some integer * program output: Output two-dimensional array */#include <iostre Am>using namespace Std;int main () {int i,j; Creates a two-dimensional integer array of 5 rows and 4 columns, assigning the initial value int a[5][4]= {{0,1},{4,5},{8,9},{12,13},{16,17}} to the 10 elements of the first two columns in the array; The keyboard input causes the value of the latter two columns 10 elements cout<< "Please enter 10 integers:" <<endl; for (i=0; i<5; i++)//i line for (j=2; j<4; j + +)//j column cin>>a[i][j]; The number in the cout<< "array by row order precedence output is:" <<endl; for (i=0; i<5; i++) {cout<< "No. <<i<<" line: "; for (j=0; j<4; j + +) cout<<a[i][j]<< ' \ t '; cout<<endl; }//Multiply all element values by 3 and save in the array cout<< "Now multiply all the elements by 3 times times ... Complete! "<<endl; cout<< "line order Priority output:" <<endl; for (i=0; i<5; i++) {cout<< "No. <<i<<" line: "; for (j=0; j<4; j + +) cout<<3*a[i][j]<< ' \ t '; cout<<endl; }//By columnPriority output (the first row of the output is the first column in the array row ...), in fact the output is "transpose") cout<< "sequencing priority output:" <<endl; for (i=0; i<4; i++) {cout<< "<<i<<" column: "; I column for (j=0; j<5; j + +)//j line cout<<3*a[j][i]<< ' \ t '; cout<<endl; }//The array is "inverted" to output (that is, the first output of the last column of the last row, the last output of the No. 0 column of row No. 0) cout<< "inverted output:" <<endl; for (i=4; i>=0; i--) {cout<< "No. <<i<<" line: "; for (j=3; j>=0; j--) cout<<a[i][j]<< ' \ t '; cout<<endl; } return 0;}
14th Week Project One (4)--toss a two-dimensional array