Align cout format as table's columns

前端 未结 4 1750
后悔当初
后悔当初 2020-12-03 04:48

I\'m pretty sure this is a simple question in regards to formatting but here\'s what I want to accomplish:

I want to output data onto the screen using cout

4条回答
  •  孤街浪徒
    2020-12-03 05:10

    you can do it with

    string str = "somthing";
    printf ("%10s",str);
    printf ("%10s\n",str);
    printf ("%10s",str);
    printf ("%10s\n",str);
    

提交回复
热议问题