What is Mistake in my Code

I have just made different StringToInt() function pl. debug it.
Code:https://ide.codingblocks.com/s/264827

if you want to take input as a string at once
then use getline because cin>>str takes only first no

    cin>>t;
    cin.get();
    while(t--)
    {
        
        string str;
       getline(cin,str);

i hope this helps
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course

@asaurabh_26 Thanks ,just one question is function of cin.ignore and cin.get same

in this case they work similarly

cin.get() will also return you character as well