fork download
  1. #include<time.h>
  2. #include<iostream>
  3.  
  4. using namespace std;
  5. clock_t start;
  6. start = clock();
  7.  
  8. int main()
  9. {
  10. int a[100],i,n,p,k,min,loc,temp;
  11.  
  12. cout<<"Enter No. of Elements=";
  13. cin>>n;
  14.  
  15. cout<<"\nEnter Elements=\n";
  16. for(i=1;i<=n;i++)
  17. {
  18. cin>>a[i];
  19. }
  20.  
  21. for(p=1;p<=n-1;p++)
  22. {
  23. min=a[p]; // Element Selection
  24. loc=p;
  25.  
  26. for(k=p+1;k<=n;k++) // Finding Min Value
  27. {
  28. if(min>a[k])
  29. {
  30. min=a[k];
  31. loc=k;
  32. }
  33. }
  34.  
  35. temp=a[p]; // Swapping Slctd Elt n min val
  36. a[p]=a[loc];
  37. a[loc]=temp;
  38.  
  39. }
  40.  
  41. cout<<"\nAfter Sorting : \n";
  42.  
  43. for(i=1;i<=n;i++)
  44. {
  45. cout<<a[i]<<endl;
  46. }
  47. double difference = (clock()-start)/(double)CLOCKS_PER_SEC;
  48. cout<<difference;
  49. return 0;
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:6:1: error: ‘start’ does not name a type
 start = clock();
 ^
stdout
Standard output is empty