Skip to content

Commit

Permalink
Cpp Stl Pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishak798 authored Feb 8, 2024
1 parent 8a4e4c4 commit b3e831c
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Pairs/Nestedpair.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <bits/stdc++.h>
using namespace std;
void printpairs(pair<int, pair<int, int>> p)
{
cout
<< p.first << endl
<< p.second.first << endl
<< p.second.second;
}
int main()
{
pair<int, pair<int, int>> p;
cout << "enter a pair value";
cin >> p.first >> p.second.first >> p.second.second;
printpairs(p);
return 0;
}
Binary file added Pairs/Nestedpair.exe
Binary file not shown.
14 changes: 14 additions & 0 deletions Pairs/pairarray.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <bits/stdc++.h>
using namespace std;
void printpairs(pair<int, int> p[])
{
cout << p[1].first << endl
<< p[1].second;
}
int main()
{
pair<int, int> p[4] = {{1, 2}, {3, 4}, {4, 5}, {6, 7}};

printpairs(p);
return 0;
}
Binary file added Pairs/pairarray.exe
Binary file not shown.
13 changes: 13 additions & 0 deletions Pairs/pairs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <bits/stdc++.h>
using namespace std;
void printpairs()
{
pair<int, int> p = {1, 3};
cout << p.first << endl
<< p.second;
}
int main()
{
printpairs();
return 0;
}
Binary file added Pairs/pairs.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions Pairs/userinppair.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <bits/stdc++.h>
using namespace std;
void printpairs(pair<int, int> p)
{
cout << p.first << endl
<< p.second;
}
int main()
{
pair<int, int> p;
cout << "enter a pair value";
cin >> p.first >> p.second;
printpairs(p);
return 0;
}
Binary file added Pairs/userinppair.exe
Binary file not shown.

0 comments on commit b3e831c

Please sign in to comment.