Code not showing output , neither shows error

#include
#include
#include
using namespace std;

string extractStringAtkey(string str, int key)
{

char *a = strtok((char *)str.c_str(), " ");

while (key > 1)
{
    a = strtok(NULL, " ");
    key--;
}

return (string)a;

}

int ConvertToInt(string a)
{
int ans = 0;
int p = 1;
for (int i = a.length() - 1; i >= 0; i++)
{
ans = ans + ((a[i] - ‘0’) * p);
p = p * 10;
}

return ans;

}

bool numericCompare(pair<string, string> s1, pair<string, string> s2)
{
string key1, key2;
key1 = s1.second;
key2 = s2.second;

return ConvertToInt(key1) < ConvertToInt(key2);

}

bool lexiCoCompare(pair<string, string> s1, pair<string, string> s2)
{
string key1, key2;
key1 = s1.second;
key2 = s2.second;

return key1 < key2;

}

int main()
{
string a[100];
int n;
cin >> n;
cin.get();

for (int i = 0; i < n; i++)
{
    getline(cin, a[i]);
}

int key;
string reversal, ordering;
cin >> key;
cin>> reversal;
cin >> ordering;

cin.get();

pair<string, string> str_pair[100];

for (int i = 0; i < n; i++)
{
    str_pair[i].first = a[i];
    str_pair[i].second = extractStringAtkey(a[i], key);
}

if (ordering == "numeric")
{
    sort(str_pair, str_pair + n, numericCompare);
}
else
{
    sort(str_pair, str_pair + n, lexiCoCompare);
}

if (reversal == "true")
{
    for (int i = 0; i < n / 2; i++)
    {
        swap(str_pair[i], str_pair[n - i - 1]);
    }
}

for (int i = 0; i < n; i++)
{
    cout << str_pair[i].first << endl;
}
return 0;

}

@yamangoyal100_ff74db54bdf01539 in convert function do i-- not i++

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.