I have problem with solution for my homework. I have to write program which calculates number of girls that we can get their phone number and how much we need to pay. Input looks like this:

5 - our starting budget;

5 - number of friends;

Mary

Angie

John

Christian

Peter - starting index is 1, and final is 5(because we are index 0)

2 - number of girls we are interested in

1 - index of girl(Mary)

2 - index of girl(Angie)

5 - number of connections between friends

0 3 0 - friend[0](we) knows friend[3] and needs to pay 0 for his number

3 4 5 - friend[3] knows friend[4] and he wants to be payed 5 bucks for friend[4] telephone number

3 5 7 - friend[3] knows friend[5] and he wants to be payed 7 bucks for friend[5] telephone number

4 1 9 - friend[4] knows friend[1] and he wants to be payed 9 bucks

for his number

5 1 1 - friend[5] knows friend[1] and he wants to be payed 1 dollar for his number

Output should be:

Mary 2 - we can get only Mary's number(and we need to pay 8 bucks for it, because we want to take cheaper option)

Real input for girl name should be F01234 and that kind of things, so we can find out who are girls.

Is it better to solve this via class or just in main?

I have this so far:

I don't know how to proceed with this code. Any kind of help is appreciated.Code:#define MAXF 20000 //max num of friends #define MAXC 1000000 //max num of connections between them #define MAXL 20 //max num of girls we are interested #define MAXB 100000000 //max budget int main() { int budget; cin >> budget; cin.get(); int friendsCnt; cin >> friendsCnt; cin.get(); string friends[MAXF]; friends[0] = "Tvrtko"; for(int i = 1; i < friendsCnt+1; i++) { getline(cin, friends[i]); } int loversCnt; cin >> loversCnt; cin.get(); string lovers[MAXL]; for(int i = 0; i < loversCnt; i++) { int tmp; cin >> tmp; cin.get(); lovers[i] = friends[tmp]; } int connectionsCnt; cin >> connectionsCnt; cin.get(); for(int i = 0; i < connectionsCnt; i++) { int indexF, indexC, price; cin >> indexF >> indexC >> price; cin.get(); } return 0; }