Advertisement
Fakhru

Untitled

Feb 15th, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. struct Product{
  6. string code[3];
  7. string category[3];
  8. string name[3];
  9. int quantity[3];
  10. float price[3];
  11. };
  12. int main()
  13. {
  14. Product hks;
  15. for(int i = 0;i < 3;i++){
  16. cout << "\nPlease insert info for Product " << i+1 << endl << "Code :";
  17. cin >> hks.code[i];
  18. cout << "Category: ";
  19. cin >> hks.category[i];
  20. cout << "Name: ";
  21. cin >> hks.name[i];
  22. cout << "Quantity: ";
  23. cin >> hks.quantity[i];
  24. cout << "Price: ";
  25. cin >> hks.price[i];
  26.  
  27. }
  28.  
  29. for(int i = 0;i < 3;i++){
  30. cout << "\n----Product: " << i+1 << " Info----\n";
  31. cout << "Name: " << hks.code[i] <<endl;
  32. cout << "\nCategory: " << hks.category[i]<<endl;
  33. cout << "\nName: " << hks.name[i]<<endl;
  34. cout << "\nQuantity: " << hks.quantity[i]<<endl;
  35. cout << "\nPrice: " << hks.price[i]<<endl;
  36.  
  37.  
  38. }
  39.  
  40. //system("pause");
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement