Ok guys, need a little help. I'm buidling 3 objects below and I need to let the user initialize them to certain values. How can I keep the quantity from erasing everytime without building separate cells? To give you an idea of what I need to do.
Code:
class Tools
{
Tools( int, float );
};
Tools::Tools( int num_items, float cost)
{
quantity = num_items;
price = cost;
}
/************************************************
Tools saws;
Tools hammers;
Tools nails;
cout << "Please enter the outstanding quantity of saws ";
cin >> num_items;
cout << endl;
cout << "Please enter the outstanding price of each saw";
cin >> cost;
cout << endl;
Tools Tools(num_items, cost); //Should I call the constuctor here?
cout << "Please enter the outstanding quantity of hammers";
cin >> num_items;
cout << endl;
cout << "Please enter the outstanding price of each hammer";
cin >> cost;
cout << endl;
cout << "Please enter the outstanding quantity of nails";
cin >> num_items;
cout << endl;
cout << "Please enter the outstanding price of box of nails";
cin >> cost;
cout << endl;
***********************************************/
So I need each object to hold a different quantity (num_items) and price (cost). How can I accomplish this?
Thanks in advance for any help.