Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- #include <iomanip>
- #include <locale>
- #include <conio.h>
- #include <string>
- #include <ctime>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "rus");
- SetConsoleOutputCP(1251);
- SetConsoleCP(1251);
- int arr[10]; int mini=0; int maxi=50;
- int arr1[maxi]={0};
- srand(time(0));
- for (int a=0; a<10; a++) arr[a]= mini + rand() % maxi ; //заполняем
- for (int a=0; a<10; a++) cout<<arr[a]<<" "; // выводим
- cout<<endl;
- for (int a=0; a<10; a++) { int c= arr[a]; arr1[c]++; } // считаем
- for (int a=0; a<maxi; a++)
- {
- if (arr1[a]!=0)
- cout<<"Элементов "<<a<<" имеем "<<arr1[a]<<"штук"<<endl;
- }
- cout<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement