Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <vector>
- #include <stdlib.h>
- using namespace std;
- void zmiany()
- {
- for(int i=0; i<ile_liczb; i++)
- {
- cout << losowe[i] << " " ;
- }
- cout << endl;
- }
- int main()
- {
- cout << "Ile liczb chcesz wylosowac: ";
- int ile_liczb {0};
- cin >> ile_liczb;
- srand(time(NULL));
- vector<int> losowe;
- for(int i=0; i < ile_liczb ; i++)
- {
- int b = rand() % 99+1;
- losowe.push_back(b);
- cout << losowe.at(i)<< " ";
- }
- for(int i=0; i < ile_liczb-1 ; i++)
- {if(losowe[i+1] < losowe[i])
- {
- swap(losowe[i], losowe[i+1]);
- }
- }
- cout << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement