Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <climits>
- #include <stdlib.h>
- #include <ctime>
- using namespace std;
- void sort( int[]);
- int main()
- {
- int a,b,tab[10];
- cout << "podaj zakres" << endl;
- srand(time(NULL));
- cin>>a>>b;
- for(int i=0;i<10;i++){
- tab[i]=rand()%(b-a+1)+a;
- }
- sort(tab);
- return 0;
- }
- void sort( int tab[]){
- for( int i=0;i<10;i++ )
- {
- for( int j=0;j<10-1;j++)
- {
- if( tab[j]>tab[j+1] )
- swap( tab[j] ,tab[j+1] );
- }
- }
- for( int i=0;i<10;i++ ){
- cout<<tab[i]<<" ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment