Thread: Sleep problem

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    30

    Sleep problem

    I use sleep in places in my code but it all goes to begining how can i fix?


    code is here


    #include <iostream.h>
    #include <conio.h>
    #include <windows.h>

    int main(void) {
    int number = 1;
    int num_of_miliseconds;
    Sleep(num_of_miliseconds);

    cout << "Hello kid's.\n";
    Sleep(1000);
    cout <<"How are you?\n";
    Sleep(1000);
    cout <<"Thats good.\n"; //this was all just example
    }
    HOw are ya?

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    106
    thats awful.......I'm having Sleep problems also. My pillow doesn't feel comfortable.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    30
    HA HA..... ok but does any1 konw how to fix it?
    HOw are ya?

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    106
    #include <iostream.h>
    #include <conio.h>
    #include <windows.h>

    int main(void) {
    int number = 1;
    int num_of_miliseconds;
    Sleep(num_of_miliseconds);

    cout << "Hello kid's.\n";
    Sleep(1000);
    cout <<"How are you?\n";
    Sleep(1000);
    cout <<"Thats good.\n"; //this was all just example
    }


    Ruflano's Makeover

    #include <iostream>
    #include <windows.h>

    int main()
    {
    int miliseconds=1000;
    cout << "Hello Kids\n";
    Sleep(miliseconds);
    cout << "How are you?\n";
    Sleep(miliseconds);
    cout << "Thats good.\n"; // bad examples I might ass

    Sleep(miliseconds);
    return 0;
    }
    Last edited by Ruflano; 03-29-2002 at 09:07 PM.

  5. #5
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    int num_of_miliseconds;
    Sleep(num_of_miliseconds);

    You use a variable that you never defined.

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    106
    yeah, not declaring a variable and then using it for a Sleep function? bad

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. sleep() problem when Time Hits Midnight
    By seemarj83 in forum C Programming
    Replies: 4
    Last Post: 05-25-2007, 02:32 AM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM