MasterGun

Book showdata

Mar 28th, 2020 (edited)
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. class book{
  5.     string Title;
  6.     string Author;
  7.     string Content;
  8. public:
  9.     book(string _Title, string _Author, string _Content) {
  10.         _Title = Title;
  11.         _Author = Author;
  12.         _Content = Content;
  13.     }
  14.     void setTitle(string _Title) {
  15.  
  16.         Title = _Title;
  17.  
  18.     }
  19.     void setAuthor(string _Author) {
  20.  
  21.         Author = _Author;
  22.  
  23.     }
  24.     void setContent(string _Content) {
  25.  
  26.         Content = _Content;
  27.  
  28.     }
  29.     void Show() {
  30.         system("color f4");
  31.         cout <<"The book is called: "<< Title << endl;
  32.         system("color f0");
  33.         cout <<"The author of the book is: "<< Author << endl;
  34.         cout <<"Intro: "<< Content << endl;
  35.     }
  36. };
  37. int main(){
  38.  
  39.     string a;
  40.     getline(cin, a);
  41.     string b;
  42.     getline(cin, b);
  43.     string c;
  44.     getline(cin, c);
  45.  
  46.     book book1(a,b,c);
  47.     book1.setAuthor(a);
  48.     book1.setTitle(b);
  49.     book1.setContent(c);
  50.     book1.Show();
  51.  
  52. system("pause");
  53. return 0;
  54.  
  55. }
RAW Paste Data