Answer to Question #263709 in C++ for malika

Question #263709

Write a statement that calls the function IncreaseItemQty with parameters notebookInfo and addQty. Assign notebookInfo with the value returned.


#include <iostream>

#include <string>

using namespace std;


struct ProductInfo {

  string itemName;

  int itemQty;

};


ProductInfo IncreaseItemQty(ProductInfo productToStock, int increaseValue) {

  productToStock.itemQty = productToStock.itemQty + increaseValue;


  return productToStock;

}


int main() {

  ProductInfo notebookInfo;

  int addQty;


  cin >> notebookInfo.itemName >> notebookInfo.itemQty;

  cin >> addQty;


  /* Your code goes here */


  cout << "Name: " << notebookInfo.itemName << ", stock: " << notebookInfo.itemQty << endl;


  return 0;

}


1
Expert's answer
2021-11-09T23:39:06-0500
#include <iostream>
#include <string>


using namespace std;


struct ProductInfo {
	string itemName;
	int itemQty;
};
ProductInfo IncreaseItemQty(ProductInfo productToStock, int increaseValue) {


	productToStock.itemQty = productToStock.itemQty + increaseValue;
	return productToStock;
}


int main() {
	ProductInfo notebookInfo;
	int addQty;
	cin >> notebookInfo.itemName >> notebookInfo.itemQty;
	cin >> addQty;
	/* Your code goes here */
	notebookInfo=IncreaseItemQty(notebookInfo,addQty);


	cout << "Name: " << notebookInfo.itemName << ", stock: " << notebookInfo.itemQty << endl;


	cin>>addQty;
	return 0;


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS