this just prints the string s in reverse.


Code: C++

cout<<"enter size of string:";
cin>>n;
cout<<"enter string:";
cin>>s;
for (int i = 0; i < n; i++)
{
cout<<s[n-i-1];
}



if you meant that the variable b is the string i don't think you should use it in the loop.
hope this helped