Untitled

 avatar
unknown
plain_text
10 days ago
636 B
3
Indexable
#include <iostream>

#include <bits/stdc++.h>

#include <thread>

using namespace std;

void function1()

{

    for (int i = 0; i < 20000000; i++)

    cout<<"+";

}

void function2()

{

    for (int i = 0; i < 20000000; i++)

    cout<<"-";

}

int main()

{

    time_t start, end;

    time(&start);

    ios_base::sync_with_stdio(false);

    thread worker1(function1);

    =

    thread worker2(function2);

    function2();

    time(&end);

    double time_taken = double(end start);

    cout << "Time taken by program is: << fixed

    <<< time_taken << setprecision(20);

    cout << sec <<< endl; "

    return 0;

}
}
}
}
Editor is loading...
Leave a Comment