Friday 24 November 2017

C++ Program to Implement Pairs in STL


Code:

#include    iostream
#include    utility
#include    string
#include    cstdlib
using namespace std;
int main()
{
    pair product1;
    pair product2 ("tomatoes",2.30);
    pair product3 (product2);
    product1 = make_pair(string("lightbulbs"),0.99);

    product2.first = "shoes";       
    product2.second = 39.90; 
    cout<<"The price of "<
    cout<<"The price of "<
    cout<<"The price of "<
    return 0;
}


Output:

The price of lightbulbs is $0.99
The price of shoes is $39.9
The price of tomatoes is $2.3


------------------
(program exited with code: 0)
Press return to continue


More C++ Programs:
















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...