Using setw and left from iomanip

I got it working! Thanks.
Last edited on
You can use the escape character \t.
1
2
3
4
    for( auto i=exampleMap.begin(); i!=exampleMap.end(); ++i)
    {
      cout << setw(8) << i->first << i->second << '\n';
    }


If you want the field to be larger than 5 characters, you need to specify a width larger than 5. You don't need the second call to setw.
Topic archived. No new replies allowed.