Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- srand (time(NULL)) ;
- int t[100];
- int i = 0 ;
- int x = 0 ;
- int y = 0 ;
- for (i;i<100;i++){
- t[i] = (rand()%101) ;
- }
- i = 0 ;
- while ( i < 100 ){
- x = t[i] ;
- y = i-1 ;
- while ( y >= 0 && t[y] > x ){
- t[y+1] = t[y];
- y = y-1 ;
- }
- t[y+1]= x ;
- i = i+1 ;
- }
- for (i=0;i<100;i++ ){
- cout << t[i]<< "--";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement