Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Liber {
  5. public:
  6. Liber() {
  7. }
  8.  
  9. Liber(string title, string author, int pages, int price) {
  10. m_title=title;
  11. m_author=author;
  12. m_pages=pages;
  13. m_price=price;
  14. }
  15.  
  16. string GetTitle() {
  17. return m_title;
  18. }
  19.  
  20. string GetAuthor(){
  21. return m_author;
  22. }
  23.  
  24. int GetPages(){
  25. return m_pages;
  26. }
  27.  
  28. int GetPrice(){
  29. return m_price;
  30. }
  31.  
  32. void SetTitle(string title) {
  33. m_title = title;
  34. }
  35.  
  36. void SetAuthor(string author){
  37. m_author = author;
  38. }
  39.  
  40. void SetPages(int pages){
  41. m_pages = pages;
  42. }
  43. void SetPrice(int price){
  44. m_price = price;
  45. }
  46.  
  47. void Print(){
  48. cout << "Autori: " << m_author << endl;
  49. cout << "Titulli: " << m_title << endl;
  50. cout << endl << "Cmimi, faqe: " << m_price << ", " << m_pages << endl;
  51. }
  52. private:
  53. string m_title, m_author;
  54. int m_pages, m_price;
  55. };
  56.  
  57. int main(){
  58. Liber b1("Don Quixote", "Servantes",300 , 10000);
  59. b1.Print();
  60.  
  61. Liber a[5] = {
  62. Liber("Keshtjella", "I.Kadare", 350, 8000),
  63. Liber("Shtepi kukulle", "H.Ibsen", 200, 40000),
  64. Liber("Fabulat e Ezopit", "Ezopi",50, 5000),
  65. Liber("L'Inferno", "Dante", 300, 9000),
  66. Liber("The Art of War", "Sun Tzu", 1000, 999999) //it's over 9000!!!!!!!!!!!!!!!
  67. };
  68.  
  69. for(int i=0; i<5; i++){
  70. a[i].Print();
  71. }
  72. cout<<endl;
  73.  
  74. Liber *b2 = new Liber("The Way of Life", "Laozi", 500, 800000);
  75. b2->Print();
  76. //cout<<&b2;
  77.  
  78. int b;
  79. cin >> b;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement