Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void count (int A[], int n)
- {
- int mas[10]={0};
- for (int i=0;i<n;i++)
- {
- switch (A[i])
- {
- case 1:
- mas[1]++;
- break;
- case 2:
- mas[2]++;
- break;
- case 3:
- mas[3]++;
- break;
- case 4:
- mas[4]++;
- break;
- case 5:
- mas[5]++;
- break;
- case 6:
- mas[6]++;
- break;
- case 7:
- mas[7]++;
- break;
- case 8:
- mas[8]++;
- break;
- case 9:
- mas[9]++;
- break;
- }
- }
- for (int i=1;i<=9;i++)
- {
- cout<<mas[i]<<" ";
- }
- }
- int main()
- {
- int n;
- int * A;
- cin>>n;
- A=new int [n];
- for (int i=0;i<n;i++)
- {
- cin>>A[i];
- }
- count(A,n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement