#include <cstdlib>#include "time.h"#include <stdio.h>#include <iostream> using namespace std; int a[10000]; int main(){ for(int i=0; i<50; ++i) a[i]=rand()0; float t=clock(); //Bubble sort for(int i=0; i<50; ++i) for(int j=i+1; j<50; ++j) if(a[j]<a[i])swap(a[i],a[j]); //Print array to screen for(int i=0; i<50; ++i) cout<<a[i]<<" "; cout<<endl<<"time - "<<(clock()-t)/1000<<endl; }
Comments