I. Questions and codes
/* File name: Enter 10 numbers from the keyboard in the array A, put the odd number in the array B, the even number is in the array c, respectively output * : Zou Peng Hui * Date of Completion: May 8, 2016 * version number: v1.0 * Description of the task and solution Method Section: * Input Description: * Problem Description: * Program output: * Problem Analysis: * Algorithm design: * * #include <iostream> using namespace std; int main () {const int n=10;int a[n],i=0,j=0,k=0;cout<< "Please enter 10 number:" <<endl;for (i=0;i<n;i++) {cin>>a[ I];} cout<< "is an even number with" <<endl;for (j=0;j<n;j++) if (a[j]%2==0) {cout<<a[j]<< "";} cout<<endl; cout<< "is an odd number with" <<endl;for (k=0;k<n;k++) if (a[k]%2!==0) {cout<<a[k]<< "";}}
Ii. Results of operation
Third, experience
In the C + + language, you must first make an array of type descriptions before using the array
Iv. Summary of Knowledge points
The subscript of an array is written in square brackets after the array name, and the index of the element is counted from 0, incremented by 1 each time
C + + experiment 5-array separation