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;
}
#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;
}
Comments
Leave a comment