5 #include "../boys/allboys.h" 6 #include "../girls/allgirls.h" 7 #include "../gifts/gift.h" 8 #include "../couples/couple.h" 9 #include "../utils/read_data.h" 10 #include "../utils/couple_utils.h" 11 #include "../utils/logger/logger.h" 13 #include "../configs.h" 15 int main(
int argc,
char **argv)
26 logger.
info(
"Processing for question 4",
true);
27 logger.
log(
"boys", std::to_string(boys.size()) +
" record read",
true);
28 logger.
log(
"girls", std::to_string(girls.size()) +
" record read",
true);
29 logger.
log(
"gifts", std::to_string(gifts.size()) +
" record read",
true);
31 std::vector<Couple> couples =
makeCouples(boys, girls, &logger);
33 logger.
log(
"couples", std::to_string(couples.size()) +
" formed",
true);
35 logger.
info(
"Couples list",
true);
36 for (
int i = 0; i < (int)couples.size(); i++)
37 logger.
log(
"couple"+std::to_string(i+1),
38 couples[i].boy->name+
" and "+couples[i].girl->name,
true);
42 if (k > (
int)couples.size()) {
43 logger.
log(
"Error",
"K is more than couples",
true);
48 logger.
info(std::to_string(k)+
" unhappiest Couples list",
true);
49 for (
int i = 0; i < (int)hc.size(); i++)
50 logger.
log(
"couple"+std::to_string(i+1),
51 hc[i].boy->name+
" and "+hc[i].girl->name,
true);
53 logger.
info(
"Performing breakup of k unhappiest couples and assign the girls new boyfriends",
true);
std::vector< Gift > readAllGifts(std::string filename)
void info(const std::string msg, bool print=false)
int main(int argc, char **argv)
void log(const std::string type, const std::string msg, bool print=false)
std::vector< Girl * > readAllGirls(std::string filename)
std::vector< Boy * > readAllBoys(std::string filename)
std::vector< Couple > getKUnhappiestCouples(std::vector< Couple > couples, int k)
std::vector< Couple > makeCouples(int k, std::vector< Boy * >, std::vector< Girl * >, Logger *logger)
void performGifting(int k, std::vector< Couple > *couples, std::vector< Gift > *giftlist, Logger *logger)
void performBreakupAndPairAgain(std::vector< Couple >happyCouples, std::vector< Couple > *couples, std::vector< Boy * > *boys, std::vector< Girl * > *girls, Logger *logger)