One, array selection from the keyboard input 10 number in the array A, the number of non-repeating in the array in array b #include<iostream> using namespace std; int main () { const int n=10; int a[n],b[n],i,j,k=0; for (i=0;i<n;i++) cin>>a[i]; for (i=0;i<n;i++) {for (j=0;j<n+1;j++) { if (i==j) continue; if (A[i]==a[j]) break; if (j==10) { b[k]=a[i]; k++ ; }}} cout<< "non-repeating array:"; for (i=0;i<k;i++) cout<<b[i]<< ","; return 0; }
Second, sum input 10 numbers from the keyboard into array a, and #include<iostream> using namespace std for positive and negative numbers in a array ; int main () { const int n=10; int a[n],i,sum1=0,sum2=0; cout<< "Input 10 number:"; for (i=0;i<n;i++) { cin>>a[i]; if (a[i]>0) sum1=sum1+a[i]; else if (a[i]<0) sum2=sum2+a[i]; } cout<< "positive and;" <<sum1<< "\ n"; cout<< "negative and;" <<sum2; return 0; }
String 0 (large/lowercase) number of letters, number of digits and number of other characters </span> #include <iostream> #include <cstdio> using namespace Std; int main () { char str[50]; int i=0,n=0,j=0,k=0,l=0; cout<< "input string:"; Gets (str); while (str[i]!= ') { if (str[i]>= ' 0 ' &&str[i]<= ' 9 ') n++; else if (str[i]>= ' a ' &&str[i]<= ' Z ') j + +; else if (str[i]>= ' A ' &&str[i]<= ' Z ') k++; else l++; i++; } cout<< "Number of Numbers:" <<n<<; cout<< "Number of lowercase letters:" <<j<<; cout<< "Number of capital letters:" <<k<<; cout<< "Number of other characters:" <<l; return 0; }
C + + fifth time job