Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <stdlib.h>
  4. #include <fstream>
  5. using namespace std;
  6.  
  7. struct newproduct
  8. {
  9. string name;
  10. double price;
  11. int stock;
  12. int sold;
  13. };
  14.  
  15. int main()
  16. {
  17. newproduct prod[200][200];
  18. int no1, no2;
  19. string productname;
  20. int i;
  21. int j;
  22. char ch;
  23. cout<< "How many products?"<<endl;
  24. cin>>no1;
  25.  
  26.  
  27.  
  28. for(i=0; i<no1; i++)
  29. {
  30. cout<< "Product "<<i+1<<":";
  31. cin>> productname;
  32. cout<< "How many of product "<<productname<<endl;
  33. cin>>no2;
  34. for(j=0; j<no2; j++)
  35. {
  36. cout<<"Name: ";
  37. cin>>prod[i][j].name;
  38. cout<<"price: ";
  39. cin>>prod[i][j].price;
  40. cout<<"stock: ";
  41. cin>>prod[i][j].stock;
  42. cout<<"sold: ";
  43. cin>>prod[i][j].sold;
  44.  
  45. cout<<"Name: ";
  46. cout<<prod[i][j].name<<endl;
  47. cout<<"price: ";
  48. cout<<prod[i][j].price<<endl;
  49. cout<<"stock: ";
  50. cout<<prod[i][j].stock<<endl;
  51. cout<<"sold: ";
  52. cout<<prod[i][j].sold<<endl;
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement