'How do you declare a stack of type struct? in c++

In the code below, how do you properly declare a stack of type struct and push strings onto the stack so that they are saved in the struct? How do you specify where you want to push the variable into a certain variable of the struct? The line that is causing an error is commented. Thanks!

#include <iostream>
#include <stack>
using namespace std;

struct purchasedItem
{
    string Name;
    float Cost;
};

int main()
{
    stack<purchasedItem> shoppingBasket;
    string word=" ";
    cout << "Enter some items:" << endl;
    while(word!="quit")
    {
        cin >> word;
        shoppingBasket.push(word); // this line causes an error
    }
return 0;
}


Solution 1:[1]

I would recommend using std::stack for such operations: http://en.cppreference.com/w/cpp/container/stack

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jubin Chheda