Added tuple example.
This commit is contained in:
parent
71adea8733
commit
ea645e96d9
18
tuple.cc
Normal file
18
tuple.cc
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include <tuple>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
// make a function that returns multiple values
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
tuple<int, int> c = make_tuple(5, 4);
|
||||||
|
cout << get<0>(c) << endl;
|
||||||
|
|
||||||
|
int a = 0;
|
||||||
|
int b = 1;
|
||||||
|
cout << a << endl;
|
||||||
|
cout << b << endl;
|
||||||
|
// swap a, b
|
||||||
|
// get a,b from func ...
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user