How to use timer in c++ CodeBlock -
k, hello trying make :"write program message on computer screen show how time remains before lesson end: if end of lesson there more 30 minutes printed report something...", tried:
#include <iostream> #include <cstdio> #include <ctime> using namespace std; int main() { int starttime = 1, endtime; endtime = 30 * 3600; clock_t start = clock(); cout<<"time: "<< start <<'\n'; if (start >= 7200) { // } else if (start == endtime) { // } }
i want show time if time == number something. tried sleep(); reason got error in codeblock.
i got "sleep not declared in scope." try including library has it...
if you're in unix, #include <unistd.h>
.
if windows, #include <windows.h>
, use sleep()
instead.
Comments
Post a Comment