Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "PetDB.h"
- #include <iostream>
- #include <string>
- #include <fstream>
- int main()
- {
- PetDB db;
- db.loadFromFile("test.txt");
- std::ofstream out("out.txt");
- {
- std::cout << "Data Base: pets" << "\n";
- for (size_t i = 0; i < db.count(); i++)
- {
- std::cout << i + 1 << ":";
- auto data = db.getRow(i);
- for (const auto& str : data)
- std::cout << " " << str;
- std::cout << "\n\n";
- }
- }
- {
- auto owners = db.getOwnerList();
- for (const auto& owner : owners)
- {
- auto [ownerID, ownerName] = owner;
- std::cout << ownerID << " : " << ownerName << "\n";
- auto pets = db.getOwnerPetCounts(owner.first);
- for (const auto& pet : pets) {
- auto [type, count] = pet;
- std::cout << "\t" << Pet::typeStr(type) << " : " << count << "\n";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement