#include <iostream>
using namespace std;
// the struct product is declared.
struct product
{
char nameProduct[50];
char category[50];
int inventory;
float price;
};
int main()
{
// The user is asked to enter information about the product.
product s;
cout << "Enter information," << endl;
cout << "Enter the product name: ";
cin >> s.nameProduct;
cout << "Please enter the product category: ";
cin >> s.category;
cout << "Please enter the number of this item left in stock: ";
cin >> s.inventory;
cout << "Please enter the price of this item: ";
cin >> s.price;
// The user's inputs are displayed.
cout << "Displaying Information," << endl;
cout << "Product name: " << s.nameProduct << endl;
cout << "Product Category: " << s.category << endl;
cout << "Number of items in stock: " << s.inventory << endl;
cout << "Price: " << s.price << endl;
return 0;
}
Comments