Web_Sailor 0 Junior Poster

Hi,

I am trying to solve a riddle. I am passing a value to multimap like this:-

combined = string1+"\t"+string2
and then setting the output to fix size using maximum length and

cout.width(combined.length()) 
cout.fill(' ')

The problem is that the fixed length format is not coming properly but when I use a space instead of tab I get the output correctly:-

combined = string1+"    "+string2.

Then I print it like below.

for (it=(mmx.begin()); it!=(mmx.end()); it++){ 
   cout.width(MaxStringSize1);
   cout.fill('0');
   cout << it->first <<"\t";
   cout.width(MaxStringSize2);
   cout.fill(' ');
   cout << it->second << endl;
 }

The output comes perfectly. Can somebody tell me why is multimap not taking the tab ? whereas it works perfectly with spaces ?

Thanks