Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<thread>
- using namespace std;
- static int value;
- int first()
- {
- std::cout<<std::endl<<" I am first one !"<<std::endl;
- std::cout<<" Give me something = ";
- cin>>value;
- return 0;
- }
- int second()
- {
- std::cout<<std::endl<<" I am second one !"<<std::endl;
- // temporizare
- int testing;
- std::cin>>testing;
- std::cout<<" - > "<<value;
- return 0;
- }
- int main()
- {
- thread sample_1(first);
- thread sample_2(second);
- // first si second ruleaza concurent !
- sample_1.join();
- sample_2.join();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement