Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- string agree;
- Books b;
- Date d;
- Bookseller bs;
- Crtificate c;
- ofstream BookInfo;
- // Write to the file
- BookInfo.open("BookInfo2.txt");
- int choice = 0;
- string monthName[] = { "January", "February", "March",
- "April", "May", "June", "July",
- "August", "September", "October",
- "November", "December" };
- do
- {
- //1. Книги
- //2. Издателство
- //3. Купи книга
- cout << "Enter a number from 1 to 3 to choose your command:\n 1 - Books\n 2 - Bookseller\n 3 - Buy a book\n";
- cin >> choice;
- if (choice < 0 && choice > 3) {
- cout << "Incorect number, please try again" << endl;
- cin >> choice;
- }
- cout << "\n";
- cout << "Menu" << endl;
- cout << "-----------------------------------" << endl;
- switch (choice)
- {
- case 1:
- cout << "\n";
- cout << "Enter Books Information:" << endl;
- cout << "-----------------------------------" << endl;
- cout << "";
- b.setBook("" "");
- b.setAuthor("" "");
- b.setNextEdition(1);
- b.setIsbnNumber(1);
- cout << "Entet date DD/MM/YY: ";
- int day, month, year;
- cin >> day >> month >> year;
- cout << endl;
- cout << day << " " << monthName[month - 1] << " " << year << endl;
- cin.get();
- cout << endl;
- b.setCirculation(1);
- cout << "Enter yes if this book is agree for certificate." << endl;
- cout << "\n";
- cin >> agree;
- if (agree._Equal("yes")) {
- cout << "\n";
- cout << "This book has certificate from MON!" << endl;
- cout << "\n";
- }
- else {
- cout << "\n";
- cout << "This book has not certificate from MON!" << endl;
- cout << "\n";
- }
- BookInfo << b.getBook();
- BookInfo << b.getAuthor();
- BookInfo << b.getNextEdition();
- BookInfo << b.getIsbnNumber();
- BookInfo << b.getCirculation();
- break;
- case 2:
- cout << "Enter Bookseller Information:" << endl;
- cout << "-----------------------------------" << endl;
- cout << "\n";
- bs.setBookseller("" "");
- bs.setAddress("" "" "" "" "");
- bs.setPhone(1);
- BookInfo << bs.getBookseller();
- BookInfo << bs.getAddress();
- BookInfo << bs.getPhone();
- break;
- case 3:
- cout << "Buy a book:" << endl;
- cout << "-----------------------------------" << endl;
- break;
- default:
- cout << "Invalid choice!";
- cout << "\n";
- break;
- }
- } while (choice != 0);
- // Close the file
- BookInfo.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement