Using Timing Loop...

Hi,

I want to print "C++ is fun" on screen, hold it for 10 second using timing loops like continue; or break or both. I am using Turbo C++ 3.0
I have printed it for 10 seconds using following code but unable from required way:
[green]
int long ctr;
for(ctr=1,ctr<210000000.5;ctr++)
{
}
clrscr();
return 0;
getch();
[/green]



Comments

  • [b][red]This message was edited by IDK at 2006-1-22 12:23:26[/red][/b][hr]
    : Hi,
    :
    : I want to print "C++ is fun" on screen, hold it for 10 second using timing loops like continue; or break or both. I am using Turbo C++ 3.0
    : I have printed it for 10 seconds using following code but unable from required way:
    : [code]
    : int long ctr;
    : for(ctr=1,ctr<210000000.5;ctr++)
    : {
    : }
    : clrscr();
    : return 0;
    : getch();
    : [/code]
    :

    Use time.h , get the time and make a loop of it.
    Why are you using 210000000.5 ? ctr is an integer so it doesn't matter if it's 210000000 or 210000000.5 or 210000000.489456

    A hint, instead of using the green tag, use code. It looks better.

    Happy coding wishes
    the one and only
    [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion