Advertisement
AntoniiaG

Untitled

May 23rd, 2022
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.40 KB | None | 0 0
  1. int main()
  2. {
  3.     string agree;
  4.     Books b;
  5.     Date d;
  6.     Bookseller bs;
  7.     Crtificate c;
  8.     ofstream BookInfo;
  9.    
  10.     // Write to the file
  11.     BookInfo.open("BookInfo2.txt");
  12.    
  13.     int choice = 0;
  14.     string monthName[] = { "January", "February", "March",
  15.             "April", "May", "June", "July",
  16.             "August", "September", "October",
  17.             "November", "December" };
  18.  
  19.     do
  20.     {
  21.         //1. Книги
  22.         //2. Издателство
  23.         //3. Купи книга
  24.         cout << "Enter a number from 1 to 3 to choose your command:\n 1 - Books\n 2 - Bookseller\n 3 - Buy a book\n";
  25.        
  26.         cin >> choice;
  27.         if (choice < 0 && choice > 3) {
  28.             cout << "Incorect number, please try again" << endl;
  29.             cin >> choice;
  30.         }
  31.         cout << "\n";
  32.         cout << "Menu" << endl;
  33.         cout << "-----------------------------------" << endl;
  34.  
  35.         switch (choice)
  36.         {
  37.         case 1:
  38.             cout << "\n";
  39.             cout << "Enter Books Information:" << endl;
  40.             cout << "-----------------------------------" << endl;
  41.             cout << "";
  42.             b.setBook("" "");
  43.             b.setAuthor("" "");
  44.             b.setNextEdition(1);
  45.             b.setIsbnNumber(1);
  46.  
  47.             cout << "Entet date DD/MM/YY: ";
  48.             int day, month, year;
  49.             cin >> day >> month >> year;
  50.             cout << endl;
  51.             cout << day << "  " << monthName[month - 1] << "  " << year << endl;
  52.             cin.get();
  53.             cout << endl;
  54.             b.setCirculation(1);
  55.  
  56.             cout << "Enter yes if this book is agree for certificate." << endl;
  57.             cout << "\n";
  58.             cin >> agree;
  59.             if (agree._Equal("yes")) {
  60.                 cout << "\n";
  61.                 cout << "This book has certificate from MON!" << endl;
  62.                 cout << "\n";
  63.             }
  64.             else {
  65.                 cout << "\n";
  66.                 cout << "This book has not certificate from MON!" << endl;
  67.                 cout << "\n";
  68.             }
  69.             BookInfo << b.getBook();
  70.             BookInfo << b.getAuthor();
  71.             BookInfo << b.getNextEdition();
  72.             BookInfo << b.getIsbnNumber();
  73.             BookInfo << b.getCirculation();
  74.             break;
  75.         case 2:
  76.             cout << "Enter Bookseller Information:" << endl;
  77.             cout << "-----------------------------------" << endl;
  78.             cout << "\n";
  79.             bs.setBookseller("" "");
  80.             bs.setAddress("" "" "" "" "");
  81.             bs.setPhone(1);
  82.             BookInfo << bs.getBookseller();
  83.             BookInfo << bs.getAddress();
  84.             BookInfo << bs.getPhone();
  85.        
  86.             break;
  87.         case 3:
  88.             cout << "Buy a book:" << endl;
  89.             cout << "-----------------------------------" << endl;
  90.  
  91.             break;
  92.         default:
  93.             cout << "Invalid choice!";
  94.             cout << "\n";
  95.             break;
  96.         }
  97.     } while (choice != 0);
  98.  
  99.     // Close the file
  100.     BookInfo.close();
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement