Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <thread>
- #include <future>
- using namespace std;
- int sum(int a, int b)
- {
- return a+b;
- }
- int increment(int a)
- {
- return ++a;
- }
- int main() {
- int i=5;
- future<int> fd = async(sum,3,5);
- future<int> fi = async(increment, i);
- double zbir = fd.get();
- i = fi.get();
- cout << "Zbir je: " << zbir << endl;
- cout << "i=" << i << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement