Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 14 / Farm / source.cpp
diff options
context:
space:
mode:
1 files changed, 19 insertions, 0 deletions
-rw-r--r--Sem. 14/Farm/source.cpp19
diff --git a/Sem. 14/Farm/source.cpp b/Sem. 14/Farm/source.cpp
new file mode 100644
index 0000000..e72e7ca
--- /dev/null
+++ b/Sem. 14/Farm/source.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+#include "../Farm/Collection/Farm.h"
+
+int main()
+{
+ Farm myFarm;
+
+ while (1)
+ {
+ size_t animalId;
+ std::cin >> animalId;
+ bool result = myFarm.addAnimal((Animal::AnimalType)animalId);
+
+ if (result)
+ std::cout << "Added animal of type: " << myFarm.getTypeByIndex(myFarm.getCount() - 1) << std::endl;
+ else
+ std::cout << "Invalid animal type" << std::endl;
+ }
+} \ No newline at end of file