Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- using namespace std;
- int main()
- {
- unsigned int st = (unsigned)time(NULL); //start time
- unsigned int ct = (unsigned)time(NULL); //current time
- unsigned int lt = (unsigned)time(NULL); //last time
- int a = 0;
- cout << "Program will close in 10 seconds" << endl;
- cout << st << endl << ct << endl << lt << endl;
- while(ct - st < 10)
- {
- ct = (unsigned)time(NULL); //update current time
- if(lt != ct)
- {
- a++;
- cout << a << " seconds have passed!" << endl;
- lt = ct;
- }
- }
- cout << "Hello world!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement