Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #define w "kratki"
- using namespace std;
- int main(int argc, char** argv) {
- setlocale(LC_ALL,"");
- int tab4[30];
- for (int i=0; i<30; i++){
- tab4[i] = rand()%11;
- cout << tab4[i] << " ";
- }
- for (int j=0; j<30; j++)
- for (int i=0; i<29; i++)
- if (tab4[i]>tab4[i+1])
- swap(tab4[i],tab4[i+1]);
- cout << endl;
- for (int i=0; i<30; i++){
- cout << tab4[i] << " ";
- }
- cout << endl;
- max = 0;
- int maxi = 0;
- s = 1;
- for (int i=0; i<29; i++){
- if (tab4[i] == tab4[i+1]) {
- s++;
- }
- else {
- if (s>max) {
- maxi = tab4[i];
- max = s;
- }
- s = 1;
- }
- }
- cout << max << " " << maxi;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement