One.
* File name: Project an array separation
* Author: Lai poetry
* Completion Date: May 10, 2016
* Version Number: v1.0
* Description of the task and solution: Enter 10 numbers from the keyboard in the array A, put the odd number in the array B, the even in the array c, and then output separately.
* Input Description: Enter 10 integers
* Description of the problem: odd and even numbers
* Program output: odd and even groups
* Problem Analysis:
* Algorithm design: For loop statement, array A[i], double branch SELECT statement.
*/
Two.
#include <iostream>using namespace Std;int main () {int a[10],b[10],c[10],i,n=0,j=0;cout<< "Please enter 10 numbers:"; for ( i=0;i<10;i++) cin>>a[i];for (i=0;i<10;i++) if (a[i]%2==0) {b[n]=a[i];n++;} else{c[j]=a[i];j++;} cout<< "Even group is:", for (i=0;i<n;i++) cout<<b[i]<< "";cout<<endl;cout<< "odd Group is:"; for (i=0 ; i<j;i++) cout<<c[i]<< ""; Cout<<endl;return 0;}
Three. Experience
1. The program was a success.
2. Although the later more study, but as long as the class to listen carefully, after-school review, homework every time carefully completed, to the back to learn also easy.
Four. Summary of Knowledge points
1. The input and output of the array must be in a circular statement.
2. Even if you do not know the number of array of numbers can also first make this array large enough, and then use I,n,j lai count.
Fifth time on-machine experiment