Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <thread>
- using namespace std;
- void count (int in = 1) {
- for (int a = 0, b = 0; a < 99999999; ++a) b = a+a*a+a*a-(a+a*a);
- cout << in << endl;
- }
- void one () {
- for (int a = 0, b = 0; a < 9999999; ++a) b = a+a*a+a*a-(a+a*a); //I know this is probably frowned upon
- cout << "\t\tOne" << endl;
- }
- int main() {
- thread t1;
- thread t2;
- for (int a = 0; a < 100; ++a) {
- t1 = thread (count, a);
- t2 = thread (one);
- t1.join (); t2.join ();
- }
- cout << "\nDone\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment