Advertisement
SergeyPGUTI

6.3.5

Nov 21st, 2015
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void  count (int  A[],  int  n)
  6.  
  7. {
  8.     int mas[10]={0};
  9.     for (int i=0;i<n;i++)
  10.     {
  11.         switch (A[i])
  12.         {
  13.         case 1:
  14.                 mas[1]++;
  15.                 break;
  16.         case 2:
  17.                 mas[2]++;
  18.                 break;
  19.         case 3:
  20.                 mas[3]++;
  21.                 break;
  22.         case 4:
  23.                 mas[4]++;
  24.                 break;
  25.         case 5:
  26.                 mas[5]++;
  27.                 break;
  28.         case 6:
  29.                 mas[6]++;
  30.                 break;
  31.         case 7:
  32.                 mas[7]++;
  33.                 break;
  34.         case 8:
  35.                 mas[8]++;
  36.                 break;
  37.         case 9:
  38.                 mas[9]++;
  39.                 break;
  40.         }
  41.     }
  42.  
  43.     for (int i=1;i<=9;i++)
  44.     {
  45.         cout<<mas[i]<<" ";
  46.     }
  47. }
  48.  
  49. int main()
  50. {
  51.     int n;
  52.     int * A;
  53.     cin>>n;
  54.     A=new int [n];
  55.     for (int i=0;i<n;i++)
  56.     {
  57.         cin>>A[i];
  58.     }
  59.     count(A,n);
  60.     return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement