Advertisement
STANAANDREY

tuple

May 14th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7.  tuple <unsigned,string,float> pers[10];
  8.  unsigned id=0,cid;
  9.  string name,cname;
  10.  float h,ch;
  11.  for (int i=0;i<3;i++)
  12.  {
  13.      id++;
  14.      cout<<"name=";cin>>name;
  15.      cout<<"h=";cin>>h;
  16.      pers[i]=make_tuple(id,name,h);
  17.  }
  18.  
  19.  for (int i=0;i<3;i++)
  20.  {
  21.      cout<<get<0>(pers[i])<<endl;
  22.  }
  23.  
  24.  tie(cid,cname,ch)=pers[1];
  25.  cout<<cid<<' '<<cname<<' '<<ch;//*/
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement