Advertisement
Luta036

PRII template za pair i unique ptr

Jun 26th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include<iostream>
  2. #include<tuple>
  3. #include<memory>
  4. using namespace std;
  5.  
  6. pair<int, int>test(int a, int b) {
  7.     return make_pair(a, b);
  8. }
  9.  
  10. void main() {
  11.     int a = 5;
  12.     int b = 7;
  13.     int c, d;
  14.     float e = 2.17;
  15.     tie<int, int>(c, d) = test(a, b);
  16.     cout <<  "a= " << a << " b= " << b << " c= " << c << " d=  " << d;
  17.     unique_ptr<float>nesto = make_unique<float>();
  18.     *nesto = e;
  19.     cout << "unique pointer nesto pokazuje na e i vrijednost je " << *nesto << endl;
  20.     system("pause");
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement