Clock
Funkcja zwraca ilość taktów zegara wykonanych od momentu rozpoczęcia procesu. Po podzieleniu przez CLOCKS PER SEC zwraca ilość sekund.
Przykład
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
int main(int argc, char *argv[])
{
cout<<clock()/CLOCKS_PER_SEC;
while((clock()/CLOCKS_PER_SEC)!=5)
{
}
cout<< "minelo 5 sekund";
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
#include <time.h>
using namespace std;
int main(int argc, char *argv[])
{
cout<<clock()/CLOCKS_PER_SEC;
while((clock()/CLOCKS_PER_SEC)!=5)
{
}
cout<< "minelo 5 sekund";
system("PAUSE");
return EXIT_SUCCESS;
}
Zobacz też:


