/* 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