Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <fstream>
- #include <string>
- #include "AnimalShelter.h"
- using namespace std;
- int main()
- {
- Shelter myShelter;
- Customer client;
- ofstream shelterLog("shelterlog.txt");
- while (true)
- {
- cout << "1. Enter new animal" << endl;
- cout << "2. Buy animal" << endl;
- cout << "3. Print all animals in the shelter" << endl;
- cout << "4. Shelter info" << endl;
- cout << "5. Add new animal place" << endl;
- cout << "6. Exit" << endl;
- int option;
- cout << "Enter option: ";
- cin >> option;
- time_t now = time(0);
- char* dt = ctime(&now);
- switch (option)
- {
- case 1:
- if (myShelter.hasFreePlace())
- {
- myShelter.InsertAnimalInList(readAnimal());
- shelterLog << dt << ": ";
- shelterLog << "Added new animal to shelter" << endl;
- }
- else
- {
- cout << "There are no free place" << endl;
- shelterLog << dt << ": ";
- shelterLog << "Try to add new animal to shelter. No free places." << endl;
- }
- break;
- case 2:
- client = Requirements();
- if (myShelter.IsFound(client))
- {
- myShelter.removeAnimalFromList(myShelter.GetAnimal(client));
- cout << "Congratulations! You buy an animal!" << endl;
- shelterLog << dt << ": ";
- shelterLog << "Bought animal from shelter." << endl;
- }
- else
- {
- cout << "Animal with this requirements not found!" << endl;
- shelterLog << dt << ": ";
- shelterLog << "Try to buy animal from shelter. Requirements not found!" << endl;
- }
- break;
- case 3:
- myShelter.printShelter();
- shelterLog << dt << ": ";
- shelterLog << "Printing animals." << endl;
- break;
- case 4:
- myShelter.shelterInfo();
- shelterLog << dt << ": ";
- shelterLog << "Printing shelter info." << endl;
- break;
- case 5:
- myShelter.increaseFreePlases();
- cout << "Plases increased!" << endl;
- shelterLog << dt << ": ";
- shelterLog << "New place for animal!" << endl;
- break;
- case 6:
- cout << "Bye, bye!" << endl;
- exit(1);
- break;
- default:
- cout << "Invalid option! Try again." << endl;
- break;
- }
- system("pause");
- system ("CLS");
- }
- shelterLog.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement