Advertisement
Guest User

Structure display

a guest
Nov 17th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct product
  5. {
  6.     char nameProduct[40];
  7.     char category[40];
  8.     int inventory;
  9.     float price;
  10. };
  11.  
  12. int main()
  13. {
  14.     student s;
  15.     cout << "Enter information," << endl;
  16.     cout << "Enter name: ";
  17.     cin >> s.nameProduct;
  18.     cout << "Please enter the product category: ";
  19.     cin >> s.category;
  20.     cout << "Please enter the number of this item left in stock: ";
  21.     cin >> s.inventory;
  22.     cout << "Please enter the price of this item: ";
  23.     cin >> s.price;
  24.  
  25.     cout << "Displaying Information," << endl;
  26.     cout << "Product name: " << s.nameProduct << endl;
  27.     cout << "Product Category: " << s.name << endl;
  28.     cout << "Number of items in stock: " << s.inventory << endl;
  29.     cout << "Price: " << s.price << endl;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement