int convert_to_int(string s)
{
int ans=0,p=1;
for(int i=s.length()-1;i>=0;i--)
{
ans+=((s[i]-'0')*p);
p=p*10;
}
}
we have string s
suppose s=“123” now we want to convert it into integer 123
we iterate on the string take character one by one and make integer from it
first we get ‘3’ which is character so we have to convert it to integer
so we subtract it from ‘0’ so that we have integer
now we multiply 3 with its place value
when we come out of loop we got our number
strpair is an array but not of the type int or char
it’s type is pair<string,string>
means at every index we have pair of string and string
if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like
: and don’t forgot to mark doubt as resolved 