|
From: Robert D B. <lon...@ju...> - 2001-03-08 00:30:46
|
Try this:
#include <ctime>
void delay(int seconds)
{
clock_t current, end;
current = clock();
end = current + CLOCKS_PER_SEC * seconds;
while(current < end)
current = clock(); // loop while current not equal end
}
Regards
lonestar36
On Wed, 07 Mar 2001 19:17:48 "Louis Barba" <bar...@ho...>
writes:
> I'm another one of those guys leaving harvesting and trying out
> programming.
> In this program I must display the time, secs, mins, and hours. I'm
> still
> working on it, I was wondering if there is a better way to make it
> wait a
> minute than doing a while loop. Also, I don't want the thing
> scrolling down
> the screen, it seems like it should not move, I have'nt wrote that
> part, but
> I will tonight. I would think that you don't do carriage return line
> feed,
> and use a backspace character ?
>
> Here's my member function prototype in the class Time
>
> // Wait a second
> void wait_a_second();
>
> Here's my "While Loop" definition in the Function File
>
> // Wait one second, set for Intel Celeron Processor 366MHZ
> void Time::wait_a_second()
> {
> int count_down = 51000000; //iterations for 366 celeron
> pocessor
> //Wait for second to lapse
> while(count_down > 0) //simple repetitive
> instruction
> {
> count_down += -1; //decrement value in
> variable
> }
> }
>
> Again, I will be working on the stationary display tonight.
>
> thanks for any ideas
>
> Louis
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|