-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtuple1.cpp
More file actions
32 lines (25 loc) · 721 Bytes
/
tuple1.cpp
File metadata and controls
32 lines (25 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Created by zing on 7/1/2020.
//
#include <tuple>
#include <iostream>
using namespace std;
auto main() -> int {
cout << "[tuples_1.cpp]" << endl;
// Initializing two Tuples
tuple<int, string, bool> t1(1, "Robert", true);
auto t2 = make_tuple(2, "Anna", false);
// Displaying t1 Tuple elements
cout << "t1 elements:" << endl;
cout << get<0>(t1) << endl;
cout << get<1>(t1) << endl;
cout << (get<2>(t1) ? "Male" : "Female") << endl;
cout << endl;
// Displaying t2 Tuple elements
cout << "t2 elements:" << endl;
cout << get<0>(t2) << endl;
cout << get<1>(t2) << endl;
cout << (get<2>(t2) ? "Male" : "Female") << endl;
cout << endl;
return 0;
}