
Patrick B. answered 10/05/19
Math and computer tutor/teacher
Bloodshed C++ shows no difference in execution times:
Here's my code:
using namespace std;
#include <iostream>
#include <stdlib.h>
#include <time.h>
#define N (100000)
int compareInt( const void * x, const void * y)
{
int *X = (int*)x;
int *Y = (int*)y;
int A=*X;
int B=*Y;
return(A-B);
}
int main()
{
int A[N];
for (int iLoop=0; iLoop<N; iLoop++)
{
A[iLoop]=rand();
}
//qsort(A,N,sizeof(int),compareInt);
clock_t t;
long sum = 0;
t=clock();
for (int iLoop=0; iLoop<N; iLoop++)
{
if (A[iLoop]<128)
{
sum = sum + A[iLoop];
}
}
t = clock()-t;
cout << t << endl;
}