Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <thread>
  5. using namespace std;
  6.  
  7. void sor(vector<int> d, int k, int h) {
  8. sort(&d[k], &d[h]);
  9. }
  10.  
  11. int main() {
  12. vector<int> a(5);
  13. for (int i = 0; i < 5; i++) {
  14. cin >> a[i];
  15. }
  16. thread t1(sort<int*>, &a[0], &a[2]);
  17. thread t2(sort<int*>, &a[3], &a[4]);
  18. t1.join();
  19. t2.join();
  20. for (int i = 0; i < 5; i++) {
  21. cout << a[i] << " ";
  22. }
  23. system("pause");
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement