> what is the problem
the problem is that string b;
creates an empty string. b[j]=a[i];
is incorrect; there are no characters in b.
> i want the first character on string a to be the last char on string b
> up until the last on a is the first on b
this would suffice.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a;
cout<< "enter string" <<endl;
cin>> a;
string b( a.rbegin(), a.rend() ) ;
cout<< b <<endl;
}