Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <thread>
- #include <windows.h>
- #include <stdio.h>
- #include <conio.h>
- using namespace std;
- int counter_variable = 1;
- void counting_function()
- {
- while(1)
- {
- Sleep(1000);
- cout << "\r";
- cout << counter_variable;
- counter_variable++;
- }
- }
- int main()
- {
- thread t1(counting_function); //execute thread
- int x;
- cin >> x;
- t1.join();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement