Esempio n. 1
0
/**********************************************************
 *                        storeValues                     *
 * This function stores user input data in the members of *
 * an InventoryItem object passed to it by reference.     *
 * ********************************************************/
void storeValues(InventoryItem &item)   
{
	int partNum;                   // Local variables to hold user input    
	string description;   
	int qty;           
	double price; 

	// Get the data from the user
	cout << "Enter data for the new part number \n";
	cout << "Part number: ";
	cin  >> partNum;
	cout << "Description: ";
	cin.get();                     // Move past the '\n' left in the
	                               // input buffer by the last input 
	getline(cin, description);
	cout << "Quantity on hand: ";
	cin  >> qty;
	cout << "Unit price: ";
	cin  >> price;

	// Store the data in the InventoryItem object
	item.storeInfo(partNum, description, qty, price);
}