I. Questions and codes
<pre name= "code" class= "CPP" >/* * file name: 1* Creator: Liang * Completion date: 2016 May 5th * Version Number: v1.0 * Description of task and solution method Section: Array Separation * Input Description: no * problem Description: Array separation * Program output: Odd even Group * problem analysis: Numbers to be categorized in their respective arrays * Algorithm design: For statement and if statement nested use */ #include <iostream> Using namespace Std;int main () {int a[10],i,b[10],c[10],k=0,m=0;for (i=0;i<10;i++) {cout<< "a[" <<i< < "]="; Cin>>a[i];} for (i=0;i<10;i++) if (a[i]%2==0) b[k++]=a[i];elsec[m++]=a[i];cout<< "even array"; for (i=0;i<k;i++) { cout <<b[i]<< "";} cout<< "Odd array"; for (i=0;i<m;i++) cout<<c[i]<< "";}
Two. Running results
Three. Experience
Arrays should be used for loops at input and output
Four. Summary of Knowledge points
1. Arrays should be used for loops at input and output
C + + fifth time on-machine experiment