Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <string>
- using namespace std;
- struct moniker {
- string name;
- bool gen;
- };
- vector <moniker> nominal;
- vector <pair <string, string>> type;
- vector <vector <pair <string, string>>> rel;
- ///void Rel()
- void Com_And_Fill(string n1, string rap, string n2)
- {
- int ind1, ind2;
- for (int i = 0; i < nominal.size(); i++)
- {
- if (n1 == nominal[i].name)
- {
- ind1 = i;
- }
- if (n2 == nominal[i].name)
- {
- ind2 = i;
- }
- }
- rel[ind1].push_back(make_pair(n2, rap));
- if (nominal[ind1].gen)
- {
- for ( int i = 0; i < 11; i++)
- if (rap == type[i].first)
- {
- if (i == 0)
- rel[ind2].push_back(make_pair(n1, type[0].second));
- else if (i == 1)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[2].first));
- else rel[ind2].push_back(make_pair(n1, type[2].second));
- }
- else if (i == 2)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[1].first));
- else rel[ind2].push_back(make_pair(n1, type[1].second));
- }
- else if (i == 3)
- {
- if(nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[3].first));
- else rel[ind2].push_back(make_pair(n1, type[3].second));
- }
- else if (i == 4)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[5].first));
- else rel[ind2].push_back(make_pair(n1, type[5].second));
- }
- else if (i == 5)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[4].first));
- else rel[ind2].push_back(make_pair(n1, type[4].second));
- }
- else if (i == 6)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[7].first));
- else rel[ind2].push_back(make_pair(n1, type[7].second));
- }
- else if (i == 7)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[6].first));
- else rel[ind2].push_back(make_pair(n1, type[6].second));
- }
- else if (i == 8)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[9].first));
- else rel[ind2].push_back(make_pair(n1, type[9].second));
- }
- else if (i == 9)
- rel[ind2].push_back(make_pair(n1, type[8].first));
- else if (i == 10)
- rel[ind2].push_back(make_pair(n1, type[8].second));
- break;
- }
- }
- else
- {
- for (int i = 0; i < 11; i++)
- if (rap == type[i].second)
- {
- if (i == 0)
- rel[ind2].push_back(make_pair(n1, type[0].first));
- else if (i == 1)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[2].first));
- else rel[ind2].push_back(make_pair(n1, type[2].second));
- }
- else if (i == 2)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[1].first));
- else rel[ind2].push_back(make_pair(n1, type[1].second));
- }
- else if (i == 3)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[3].first));
- else rel[ind2].push_back(make_pair(n1, type[3].second));
- }
- else if (i == 4)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[5].first));
- else rel[ind2].push_back(make_pair(n1, type[5].second));
- }
- else if (i == 5)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[4].first));
- else rel[ind2].push_back(make_pair(n1, type[4].second));
- }
- else if (i == 6)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[7].first));
- else rel[ind2].push_back(make_pair(n1, type[7].second));
- }
- else if (i == 7)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[6].first));
- else rel[ind2].push_back(make_pair(n1, type[6].second));
- }
- else if (i == 8)
- {
- if (nominal[ind2].gen)
- rel[ind2].push_back(make_pair(n1, type[9].first));
- else rel[ind2].push_back(make_pair(n1, type[9].second));
- }
- else if (i == 9)
- rel[ind2].push_back(make_pair(n1, type[8].first));
- else if (i == 10)
- rel[ind2].push_back(make_pair(n1, type[8].second));
- break;
- }
- }
- }
- int main()
- {
- type.push_back(make_pair("Husband", "Wife"));//0
- type.push_back(make_pair("Father", "Mother"));//1
- type.push_back(make_pair("Son", "Daughter"));//2
- type.push_back(make_pair("Brother", "Sister"));//3
- type.push_back(make_pair("Grandfather", "Grandmother"));//4
- type.push_back(make_pair("Grandson", "Granddaughter"));//5
- type.push_back(make_pair("Nephew", "Niece"));//6
- type.push_back(make_pair("Uncle", "Aunt"));//7
- type.push_back(make_pair("Son_In_Law", "Daughter_In_Law"));//8
- type.push_back(make_pair("Father_In_Law_From_Wife", "Mother_In_Law_From_Wife"));//9
- type.push_back(make_pair("Father_In_Law_From_Husband", "Mother_In_Law_From_Husband"));//10
- int N;
- scanf("%d", &N);
- nominal.resize(N);
- rel.resize(N);
- string a, b, c;
- for (int i = 0; i < N; ++i)
- {
- cin >> nominal[i].name >> a;
- if (a[0] == 'M')
- nominal[i].gen = true;
- else nominal[i].gen = false;
- }
- int M;
- scanf("%d", &M);
- for (int i = 0; i < M; ++i)
- {
- cin >> a >> b >> c;
- Com_And_Fill(a, b, c);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment