#include <utility>
#include <string>
#include <iostream>
int main()
{
std::pair<std::string,double> product_1; //default constructor
std::pair<std::string,double> product_2("tomatoes",2.30); //value init
std::pair<std::string,double> product_3(product_2); // copy constructor
product_1=std::make_pair(std::string("lightbulbs"),0.99); //using make_pair(move)
product_2.first="shoes"; // the type of first is string
product_2.second=39.90; //the type of second is double
std::cout<<"the price of "<<product_1.first<<"is $"<<product_1.second<<'\n';
std::cout<<"the price of "<<product_2.first<<"is $"<<product_2.second<<'\n';
std::cout<<"the price of "<<product_3.first<<"is $"<<product_3.second<<'\n';
}
#include <cstdlib>
#include <iostream>
#include <queue>
using namespace std;
int main()
{
int e,n,m;
queue<int> q1;
for(int i=0;i<10;i++)
q1.push(i);
if(q1.empty())
cout<<"queue is empty.\n";
n=q1.size();
cout<<n<<endl;
m=q1.back();
cout<<m<<endl;
for(int j=0;j<n;j++)
{
e=q1.front();
cout<<e<<" ";
q1.pop();
}
cout<<endl;
if(q1.empty())
cout<<"queue is empty.\n";
return 0;
}