Timer

I'm looking to make a timer, that after a set amount of time will cout a message.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <ctime>
using namespace std;

int main()
{
 int a = clock();
    if (a == 300){
            cout << "Your time is up.";
         
            }
cin.get();
return 0;
}


This doesn't do anything.
closed account (S6k9GNh0)
Your code formatter deserves to be shot.
That of course would absolutely do nothing. I suggest you google C++ Timers.
Last edited on
Well, I use bloodshed dev C++, sorry I don't have any money for a real compiler....
closed account (S6k9GNh0)
JFloyd, that has nothing to do with anything. 95%+ of us here use a free compiler. You just need a compiler that abides C++ standard.
Last edited on
What are you talking about, "real compiler?" You wouldn't have to pay for a good compiler, that'd be what makes it good. Besides that, Dev-C++ is an IDE (and not even a good one, it's old). Download Code::Blocks. It's another IDE, and it comes with a more up-to-date version of MinGW.
Topic archived. No new replies allowed.