C + + experiment five-array separation

Source: Internet
Author: User

/* File name: 22 *:    Shangcong  * Completion date:     May   10th * Version Number: v1.0 * Description of task and solution method part: Array separation * Input Description:  Enter 10 from the keyboard The number is placed in array A * Problem Description: * Program output: Odd even * problem analysis: I j indicates the number of cycles * Algorithm design: Put the array of odd numbers into the array B, the even in the array C after the output  */#include <iostream>using namespace Std;int main () {int m,n=0,d=0,i=0,j=0; int a[10],b[10],c[10]; cout<< "Please enter 10 integers:"; for (m=0;m<10;m++) cin>>a[m]; for (m=0;m<10;m++) {if (a[m]%2==0) {b[n++]=a[m];   i++;} else{C[d++]=a[m];   j + +;}}  cout<< "even:";  for (n=0;n<i;n++)  cout<<b[n]<< "  ";  cout<<endl;  cout<< "Odd:";  for (d=0;d<j;d++)  cout<<c[d]<< "  ";  cout<<endl;  return 0;}

Third, Experience:

There are small obstacles in the middle, successfully overcome.

C + +, I will learn it well!

Iv. Summary of Knowledge points:

It is important to write the code of the program written by the blog post, the minimum requirement

C + + experiment five-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.