Jump to content

metallicsoul92

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by metallicsoul92

  1. This will only work in MSVS, in other cases you have to

    #include <windows.h>

    This also means that the code won't be portable to other architectures. I usually use the following function (not sure if you've gotten as far as functions), although understanding how it works may be out of your grasp at the moment. But don't worry, as you progress in your learning you'll soon understand it easily:

     

    #include <ctime>
    #include <cstdio>
    
    void timePause(int seconds) 
    {
       clock_t endwait;
       endwait = clock () + seconds * CLOCKS_PER_SEC ;
       while (clock() < endwait) {}
    }
    
    int main()
    {
      printf("And we shall wait for 3 seconds before the window closes...");
      timePause(3);
      return 0;
    }
    

    -Source

     

    I think the best thing to do is to use the Code::Blocks IDE, which pauses the console by itself. And it's also great in debugging and quite frankly in every other regard as well, at least in my opinion.

     

    this was my favorite response. i didnt even think about using a clock haha.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.