Right now im making a converting program for myself. I got it to convert correctly but it only converts one character
so here is my code
map<string,string>datamap;
datamap["A#"]="b";
datamap["C"]="DD";
string change;
getline(cin,change);
for(int i=0; i<change.size(); i++)
{
//output based on what character gets passed to the map
cout << datamap[string(change.begin() +i,change.begin() +i+1)];
}
the problem is it only converts the C and not AA. so if i eneter CCA#A#C it would cout DDDDDD. i read somewhere that you can peek at the next character and if it is a # you read it the way you were reading characters so that you can add it to your key for the map. but i dont get how you would do this.