"Item 2: Array Selection"
#include <iostream.h>void main () {const int n=10;int a[n],b[n],j=0,k=0,t=0;cout<< "Please enter" <<N<< " Number: "; for (int i=0;i<n;i++) {cin>>a[i];} for (i=0;i<n;i++) {for (j=0;j<n;j++) {if (a[i]!=a[j]) k++;} if (k==n-1) {b[t]=a[i];t++;} k=0;} The values in the cout<< "B array are:"; for (i=0;i<t;i++) {cout<<b[i]<< "";} Cout<<endl;}
"Item 3: Achievements"
#include <iostream.h>void main () {const int n=10;int a=0,b=0; Double score[n],score1[n],score2[n];cout<< "Please enter Group" <<N<< "Students ' scores:" <<endl;for (int i=0;i<n ; i++) {Cin>>score[i];if (score[i]>100| | score[i]<0) cout<< "score error, please re-enter";} cout<< "Statistical results are as follows:" <<endl;double max,min,aver;max=min=aver=score[0];for (i=0;i<n;i++) {aver+=score[i]; if (Score[i]>max) Max=score[i];else if (score[i]<min) min=score[i];} aver=aver/n;cout<< "The highest score is:" <<max<<endl;cout<< "minimum score is:" <<min<<endl;cout< < "average score is:" <<aver<<endl;for (i=0;i<n;i++) {if (Score[i]==max) {score1[a]=i;a++;} if (score[i]==min) {score2[b]=i;b++;}} cout<< "The highest scores of students have" <<a<< ", is"; for (i=0;i<a;i++) {cout<<score1[i]+1<< "classmate"; if (i< A-1) cout<< "and";} cout<<endl;cout<< "The lowest grade students have" <<b<< "bit, is"; for (i=0;i<b;i++) {cout<<score2[i]+1< < "classmate"; if (i<b-1) cout<< "and";} Cout<<endl;}
"Item 5: Summation"
#include <iostream.h>void main () {const int n=10;int a[n],j=0,k=0,t=0;cout<< "Please enter" <<N<< "number:"; for (int i=0;i<n;i++) {cin>>a[i];} for (i=0;i<n;i++) {if (a[i]>=0) j+=a[i];elsek+=a[i];} The sum of the positive numbers in the cout<< array is: the sum of the negative numbers in the <<j<<endl;cout<< array: "<<K<<ENDL;}
C + + Job 5