Im Going Crazy Help!!!!

This is a discussion on Im Going Crazy Help!!!! within the C++ Programming forums, part of the General Programming Boards category; IVE TRYED ALOT EVERYTHING ON MY OTHR THREAD "I NEED A CODE" BUT NONE OF IT WORKS! WHATS THE CODE ...

  1. #1
    Registered User Prodigy's Avatar
    Join Date
    May 2002
    Posts
    25

    Exclamation Im Going Crazy Help!!!!

    IVE TRYED ALOT EVERYTHING ON MY OTHR THREAD "I NEED A CODE" BUT NONE OF IT WORKS! WHATS THE CODE TO PAUSE LIKE FOR 5 SECONDS FOR EX.

    THANK YOU
    And the cows moo...
    AIM:ProdigyCpp
    E-Mail:ProdigyMan911@aol.com
    If you like my avatar plz dont copy it go to:
    http://www.dragid.com/

  2. #2
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    #include <iostream.h>
    #include <windows.h>

    int main()
    {
    cout<<"Pauseing for 5 seconds"<<endl;
    Sleep(5000); /* Notice capital 'S' in Sleep */
    cout<<"Done pauseing"<<endl;
    return 0;
    }

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    317
    Or you could try a little more elaborate variation:

    #include<iostream>
    #include<ctime> //or use time.h file


    int main()
    {
    float secs = 5;
    clock_t delay = secs * CLOCKS_PER_SEC; //convert to clock tics
    clock_t start = clock();
    while(clock() - start < delay)
    ;
    return (0);
    }

    this allows more portability since you don't have to change delay when you change processor speed.

    Edit: Also try using CLK_TCK or TCK_CLK instead of CLOCKS_PER_SEC.
    Last edited by Traveller; 05-05-2002 at 03:54 PM.

  4. #4
    Registered User Prodigy's Avatar
    Join Date
    May 2002
    Posts
    25
    Originally posted by Dual-Catfish
    #include <iostream.h>
    #include <windows.h>

    int main()
    {
    cout<<"Pauseing for 5 seconds"<<endl;
    Sleep(5000); /* Notice capital 'S' in Sleep */
    cout<<"Done pauseing"<<endl;
    return 0;
    }
    That dont work im using a dos program
    And the cows moo...
    AIM:ProdigyCpp
    E-Mail:ProdigyMan911@aol.com
    If you like my avatar plz dont copy it go to:
    http://www.dragid.com/

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    139
    _sleep(5); //which sleeps for 5 seconds (dos.h)
    "The most common form of insanity is a combination of disordered passions and disordered intellect with gradations and variations almost infinite."

  6. #6
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    Posts
    236
    There have been about 4 reply's across your threads that should work on a DOS platform. So instead of just saying it doesn't work, and have people say the same things over and over. How about you

    A) Describe what's not working (errors?)
    B) Post your code (Use code tags)
    C) Tell us what compiler you're using.

    If you can't get a working answer first time after providing the board with that information, then you've got problems.

  7. #7
    Registered User Prodigy's Avatar
    Join Date
    May 2002
    Posts
    25
    A) Describe what's not working (errors?)
    B) Post your code (Use code tags)
    C) Tell us what compiler you're using.
    Yea sry ur right well it doesnt matter any more cause travellers code worked thx traveller
    And the cows moo...
    AIM:ProdigyCpp
    E-Mail:ProdigyMan911@aol.com
    If you like my avatar plz dont copy it go to:
    http://www.dragid.com/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is AOL music crazy?
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 03-24-2006, 06:24 PM
  2. restart drives me crazy
    By Jumper in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 03-17-2004, 11:52 AM
  3. crazy
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 08-31-2002, 08:54 PM
  4. crazy output
    By asirep in forum C Programming
    Replies: 22
    Last Post: 04-09-2002, 11:41 AM
  5. Replies: 1
    Last Post: 02-24-2002, 05:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21