Advertisement
danql45

Untitled

Jun 12th, 2019
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <math.h>
  4. #include <time.h>
  5. #include <stdio.h>
  6. #include <cstdlib>
  7. #include <vector>
  8.  
  9. using namespace std;
  10.  
  11. void fillVector(vector<orderItem>&towary)
  12. {
  13.     int quantity;
  14.     for (int i=0; i<10;i++)
  15.     {
  16.        cout<<"elko";
  17.     }
  18.     orderItem actualQuantity(quantity);
  19.     towary.push_back(actualQuantity);
  20.     cout<<endl;
  21.     // for (int i=0; i<)
  22.    
  23. }
  24.  
  25. // class Order
  26. // {
  27. //     vector<int> towary;
  28. // };
  29.  
  30. class orderItem
  31. {
  32. protected:
  33.     int quantity;
  34.    
  35. public:
  36.     void showq()
  37.     {
  38.         cout<<quantity;
  39.     }
  40.     orderItem(int q=0)
  41.     {
  42.         quantity = q;
  43.     }
  44. };
  45.  
  46. class Item
  47. {
  48. protected:
  49.     string Title;
  50.     int price;
  51.  
  52. public:
  53.     void show()
  54.     {
  55.         cout<<"Tytul: "<<Title<<" Cena: "<<price;
  56.     }
  57.  
  58.     Item(string t="brak tytulu ", int p=0)
  59.     {
  60.         Title = t;
  61.         price = p;
  62.     }
  63.  
  64. };
  65.  
  66. class DVD:protected Item
  67. {
  68.     int length;
  69.     string format;
  70.  
  71. public:
  72.     void show()
  73.     {
  74.         cout<<endl<<"DVD"<<endl;
  75.         Item::show();
  76.         cout<<" Dlugosc: "<<length<<" Format: "<<format<<endl;
  77.     }
  78.  
  79.     DVD(string nt="LoTR", string f="FullHD", int p=60, int l=218):Item(nt,p)
  80.     {
  81.         format = f;
  82.         length = l;
  83.     }
  84.  
  85. };
  86.  
  87. class CD:protected Item
  88. {
  89.     int length;
  90.  
  91. public:
  92.     void show()
  93.     {
  94.         cout<<endl<<"CD"<<endl;
  95.         Item::show();
  96.         cout<<" Dlugosc: "<<length<<endl;
  97.     }
  98.  
  99.     CD(string nt="Szwadron", int p=24, int l=59):Item(nt,p)
  100.     {
  101.         length = l;
  102.     }
  103.  
  104. };
  105.  
  106. class Book:protected Item
  107. {
  108.     int pages;
  109.  
  110. public:
  111.     void show()
  112.     {
  113.         cout<<endl<<"Ksiazka"<<endl;
  114.         Item::show();
  115.         cout<<" Ilosc stron: "<<pages<<endl;
  116.     }
  117.  
  118.     Book(string nt="Black Mirror", int p=78, int pag=318):Item(nt,p)
  119.     {
  120.         pages = pag;
  121.     }
  122.  
  123. };
  124.  
  125.  
  126.  
  127. int main()
  128. {
  129.     // DVD d1;
  130.     // d1.show();
  131.     // CD c1;
  132.     // c1.show();
  133.     // Book b1;
  134.     // b1.show();
  135. //     // orderItem o1(14);
  136. //     // o1.showq();
  137. //     // vector<orderItem> towary;
  138. //     // towary.push_back(0);
  139. //     // for( int i = 0; i < 10; i++)
  140. //     // {
  141. //     //     towary.push_back(i);
  142. //     //     printf("%d",i);
  143. //     // }
  144. //     // cout<<endl<<towary.size();
  145. // vector <double> v1; // Empty vector of doubles.
  146. // v1.push_back (32.1);
  147. // v1.push_back (40.5);
  148. // for (int i = 0; i < v1.size (); i++)
  149. //     cout << v1[i] << " ";
  150. // cout << endl;
  151.     return 0;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement