|
From: <mo...@ju...> - 2002-08-16 04:58:52
|
Running the program below in Dev-C++, Version 4, took between 209 and 235
seconds on my system. I don't know why the running times vary, but even
taking the fastest time of 209 seconds, it compares unfavorably with a
similar program compiled (36 seconds) or interpreted (55 seconds) in
QBasic 4 .
Does Dev-C++ really produce such leisurely code? Or can the program be
speeded up?
Allan
// This program prints (1) integers 1 to 1,000,000
// (2) starting & ending times
//======================================================
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char *argv[])
{
struct tm *ptr;
time_t loc_time;
long int x;
loc_time = time(NULL);
ptr = localtime(&loc_time);
for (x = 1;x <= 1000000;x++)
printf("%d ",x);
printf("\nStarting time is ");
printf(asctime(ptr));
loc_time = time(NULL);
ptr = localtime(&loc_time);
printf("\nEnding time is ");
printf(asctime(ptr), "\n");
system ("PAUSE");
return 0;
}
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today! For your FREE software, visit:
http://dl.www.juno.com/get/web/.
|