Questions and codes
/* Copyright (c) 2014, Yantai University School of Computer * All rights reserved. * File name: Test.cpp * Author: Simbin * Completion Date: November 27, 2014 * Version number: v1.0 * * Problem description: Output all even numbers. * Input Description: The latter two column elements. * Program output: even array elements; */#include <iostream>using namespace Std;int main () {int i,x,y; int a[5][4]= {{0,1},{4,5},{8,9},{12,13},{16,17}}; cout<< "Please enter 10 integers:" <<endl; for (x=0; x<5; x + +) for (y=2; y<4; y++) cin>>a[x][y]; The value in the cout<< "array is:" <<endl; for (x=0; x<5; x + +) {cout<< "" <<x<< "line:"; for (y=0; y<4; y++) cout<<a[x][y]<< ""; cout<<endl; } cout<< "Now multiply all elements by 3 times times ... Complete! "<<endl; cout<< "sequencing priority output:" <<endl; for (y=0; y<4; y++) {cout<< "<<y<<" column: "; for (x=0; x<5; x + +) cout<<3*a[x][y]<< ""; cout<<endl; } cout<< "Inverted output:" <<endl; for (x=4; x>=0; x--) {cout<< "first" <<x<< "line:"; for (y=3; y>=0; y--) cout<<3*a[x][y]<< ""; cout<<endl; } cout<< "Array of even:" <<endl; for (x=0; x<5; x + +) for (y=0; y<4; y++) if (3*a[x][y]%2==0) cout<< "a[" <<x& lt;< "[" <<y<< "]=" <<3*a[x][y]<<endl; return 0;}
Operation Result:
The 14th week on the Machine practice project of the two-dimensional array (4)