Advertisement
mario_mos

tuple mario

Sep 1st, 2023 (edited)
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <tuple>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. auto myFunction() {
  8.     return make_tuple('B', "28", "Mario");
  9. }
  10.  
  11. int main()
  12. {
  13.     auto t1 = make_tuple('A',"21", "Joe John");
  14.     cout << get<0>(t1) << " " << get<1>(t1) << " " << get<2>(t1) << endl;
  15.     get<0>(t1) = 'B';
  16.     get<1>(t1) = "77";
  17.     get<2>(t1) = "Marc";
  18.     cout << get<0>(t1) << " " << get<1>(t1) << " " << get<2>(t1) << endl;
  19.  
  20.  
  21.     auto t2 = myFunction();
  22.     cout << get<0>(t2) << endl;
  23.     cout << get<1>(t2) << endl;
  24.     cout << get<2>(t2) << endl;
  25.  
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement