Format output in a table, C++(在表格中格式化输出,C++)
问题描述
如何在 C++ 中的表中将数据输出到控制台?在 C# 中有一个问题,但我在 C++ 中需要它.
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++.
这个,除了在 C++ 中:如何To:在控制台应用程序中绘制表格的最佳方法(C#)
This, except in C++: How To: Best way to draw table in console app (C#)
推荐答案
你不能做一些非常类似于 C# 示例的事情:
Can't you do something very similar to the C# example of:
String.Format("|{0,5}|{1,5}|{2,5}|{3,5}|", arg0, arg1, arg2, arg3);
喜欢:
printf("|%5s|%5s|%5s|%5s|", arg0, arg1, arg2, arg3);
这是我用来做这个的参考:http://www.cplusplus.com/reference/clibrary/cstdio/printf/
Here's a reference I used to make this: http://www.cplusplus.com/reference/clibrary/cstdio/printf/
这篇关于在表格中格式化输出,C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在表格中格式化输出,C++


基础教程推荐
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 初始化列表*参数*评估顺序 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- CString 到 char* 2021-01-01