C + + experiment 5-array separation

Source: Internet
Author: User

I. Questions and codes

/* File name: scj*    : Sangchujia * Completion Date: May 8, 2016 * version number: v1.0 * Description of the task and solution method part: Array separation. * Input Description: Enter 10 number * Problem Description: Enter 10 numbers from the keyboard in the array A, put the odd number in the array B, the even number is placed in the array C and output separately. * Program output: Odd, even what is the problem analysis: slightly * algorithm design: Slightly */  #include <iostream>    using namespace std;    int main ()   {    cout<< "enter 10 numbers"; int a[10];for (int i=0;i<10;i++) {cin>>a[i];} cout<< "Even is:" <<endl;for (int j=0;j<10;j++) if (a[j]%2==0) {cout<<a[j]<< "";} cout<<endl;cout<< "Odd:" <<endl;for (int k=0;k<10;k++) if (a[k]%2!=0) {cout<<a[k]<< " ";}}

Ii. Results of operation

Third, experience

This chapter has more knowledge about array problems, so we have to practise more.

Iv. Summary of Knowledge points

How to handle various array problems

C + + experiment 5-array separation

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.