Advertisement
Guest User

Почти готов но не совсем

a guest
Feb 18th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "stdio.h"
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. class book {
  8. private:
  9.     float cost;
  10.     char name[128], autor[128];
  11. public:
  12.    
  13.     book() {
  14.         cout << "Введите название книги: ";
  15.         cin.getline(name, 128);
  16.         cout << "Введите автора (в родительном падеже): ";
  17.         cin.getline(autor, 128);
  18.         cout << "Введите цену: ";
  19.         cin >> cost;
  20.     }
  21.  
  22.     void getData() //Output
  23.     {
  24.         cout << "\n Вы внесли в список книгу: " << name<< ", за авторством: " << autor <<", и выставили цену: "<<cost << endl ;
  25.     }
  26.     ~book()
  27.     {
  28.         cout << "\n Работа с класом завершена!" << endl;
  29.         system("pause");
  30.     }
  31.    
  32.    
  33. };
  34.  
  35. int main()
  36. {
  37.     setlocale(LC_ALL, "rus");
  38.     book tolstoy;
  39.     tolstoy.getData();
  40.     getchar();
  41.    
  42.     return 0;
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement