The 14th week on the Machine practice project of the two-dimensional array (4)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.