Format output in a table, C++

前端 未结 4 1557
春和景丽
春和景丽 2020-12-09 20:30

How can I output data to the console in a table in C++? There\'s a question for this in C#, but I need it in C++.

This, except in C++: How To: Best way to draw table

4条回答
  •  醉酒成梦
    2020-12-09 21:10

    Check the column value length and also keep the length of value in mind to format.

    printf(" %-4s| %-10s| %-5s|\n", "ID", "NAME", "AGE");
    

    See how MySQL shell interface was designed, it will give you a good idea.

提交回复
热议问题