Guest User

Untitled

a guest
Jul 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. class product
  8. {
  9. public :
  10. int prodid;
  11. string description;
  12. double price;
  13. product(){};
  14. product(int id,string d,double p)
  15. {
  16. prodid = id;
  17. description = d;
  18. price = p;
  19.  
  20.  
  21. }
  22. void show()
  23. {
  24. cout<<prodid<<" "<<description<< " "<<price<<endl;
  25.  
  26. }
  27.  
  28.  
  29. };
  30.  
  31. int main()
  32. {
  33. product m[3];
  34. for (int i=0;i<3;i++)
  35. {
  36. cout <<"enter the product " <<endl;
  37. cin>>m[i].prodid>>m[i].description>>m[i].price;
  38. }
  39.  
  40. for (int i=0;i<3;i++)
  41. {
  42. m[i].show();
  43. }
  44. system("pause");
  45. }
Add Comment
Please, Sign In to add comment