-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
46 lines (33 loc) · 933 Bytes
/
test.cpp
File metadata and controls
46 lines (33 loc) · 933 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<iostream>
#include<stdio.h>
#include<utility>
#include<typeinfo>
#include<tuple>
void nested_func(unsigned int* num)
{
*num = 32;
}
int func()
{
unsigned int num;
nested_func(&num);
return num;
}
int main()
{
printf("%d", func());
std::pair<std::string, double> pair1;
pair1 = std::make_pair<std::string, double>("Word", 2.0);
std::cout << " \n" << typeid(pair1.first).name() << " : " << pair1.second << std::endl;
int myint;
char mychar;
std::tuple<int,float,char> mytuple;
mytuple = std::make_tuple (10, 2.6, 'a'); // packing values into tuple
std::tie (myint, std::ignore, mychar) = mytuple; // unpacking tuple into variables
std::cout << "myint contains: " << myint << '\n';
std::cout << "mychar contains: " << mychar << '\n';
myint = 30;
std::cout << "\n" << std::get<0>(mytuple) << std::endl;
std::cout << "myint contains: " << myint << '\n';
return 0;
}