I. Questions and codes
/* File name: Array separator * Creator: Dragon late autumn * finish date: 20160505 * Version number: v1.0 * Description of task and solution method part: * Input Description: None * Problem Description: Enter 10 numbers from the keyboard in the array A, put the odd number in the array B, and even put in the array c after the output. * Program output: No * problem analysis: slightly * algorithm design: Slightly * /#include <iostream>using namespace Std;int main () { const int n=10; int a[n],b[n],c[n],i,j=0,k=0; cout<< "Please enter 10 number:" <<endl; for (I=0;i<n;++i) { cin>>a[i]; if (a[i]%2==0) { b[j]=a[i]; j + +; } else { c[k]=a[i]; k++; } } cout<< "even array:"; for (i=0;i<j;i++) cout<<b[i]<< ""; cout<<endl; cout<< "odd array:"; for (i=0;i<k;i++) cout<<c[i]<< "";
two. Running Results
Three. Experience
This learning array is difficult, the main is that they do not have enough to do the problem at the time of more difficult, the process appeared in a number of errors, with the help of students to correct.
Four. Summary of Knowledge points
The use of array knowledge
C + + experiment 5-array separation