Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. ======================HOW ITS DECLARED======================
  2.  
  3. struct pinfo {
  4. int pstock; float pcost; string psku, pname;
  5. };
  6.  
  7. const int maxproduct = 20;
  8. const int provals = 4;
  9. string prods [maxproduct] [provals];
  10.  
  11. =============================================================
  12.  
  13.  
  14.  
  15. to_string is used to convert float and int from struct here:
  16.  
  17. ========================HOW ITS SAVED========================
  18. cout<<"\n\nEnter the Product Name: ";
  19. cin>>newproduct.pname;
  20. cout<<"\n\n Enter the Product SKU tag: ";
  21. cin>>newproduct.psku;
  22. cout<<"\n\n Enter the Product Stock: ";
  23. cin>>newproduct.pstock;
  24. cout<<"\n\n Enter the Product Cost in USD: ";
  25. cin>>newproduct.pcost;
  26.  
  27.  
  28. cout<<"\n\n This is what was entered:";
  29. prods [rowchoice] [0] = newproduct.pname;
  30. prods [rowchoice] [1] = newproduct.psku;
  31. prods [rowchoice] [2] = to_string(newproduct.pstock);
  32. prods [rowchoice] [3] = to_string(newproduct.pcost);
  33.  
  34. =============================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement