I. Questions and codes
/* File name: Array Separator * by: Liang Zhou * completion date: 5 months * Version number: v1.0 * Description of task and solution method part: process Sequence using an array * input description: Enter 10 number * Problem Description: Detach It * program output: odd-even separation * problem analysis: * Algorithm design: * * #include <iostream>using namespace Std;int Main () {const int n=10;inta[n],b[n],c[n],i,j=0,k=0;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<< "odd array:"; for (i=0;i<k;i++) cout<<c[i]<< ","; return 0;}
Two. Running results
Three. Experience
Feeling C + + is becoming more and more difficult, it may be a talent problem, it always feels magical, but I still need to spend a lot of time on it to write my homework.
Four. Summary of Knowledge points
C + + Fifth experiment--array separation