I. Questions and codes
/* File name: scj* : Sangchujia * Completion Date: May 8, 2016 * version number: v1.0 * Description of the task and solution method part: Array separation. * Input Description: Enter 10 number * Problem Description: Enter 10 numbers from the keyboard in the array A, put the odd number in the array B, the even number is placed in the array C and output separately. * Program output: Odd, even what is the problem analysis: slightly * algorithm design: Slightly */ #include <iostream> using namespace std; int main () { cout<< "enter 10 numbers"; int a[10];for (int i=0;i<10;i++) {cin>>a[i];} cout<< "Even is:" <<endl;for (int j=0;j<10;j++) if (a[j]%2==0) {cout<<a[j]<< "";} cout<<endl;cout<< "Odd:" <<endl;for (int k=0;k<10;k++) if (a[k]%2!=0) {cout<<a[k]<< " ";}}
Ii. Results of operation
Third, experience
This chapter has more knowledge about array problems, so we have to practise more.
Iv. Summary of Knowledge points
How to handle various array problems
C + + experiment 5-array separation