12345678910111213141516171819202122232425262728293031
#include<iostream> #include<time.h> using namespace std; void main() { int max=5; int num[max]={2,1,3,4,0}; int i,j; clock_t start = clock() / (CLOCKS_PER_SEC / 1000); for (i=0; i<max; i++) { for(j=i+1; j<max; j++) { if (num[i]>num[j]) swap(num[i], num[j]); } } for (i=0; i<max; i++) cout<<num[i]<<","; cout<<"\n\n"; clock_t elapsed = clock() / (CLOCKS_PER_SEC / 1000) - start; system("pause"); } Put the code you need help with here.
1234567
unsigned start = time(0); //do stuff unsigned end = time(0); std::cout << end - start << std::endl; //number of seconds passed
int const max = 5;