【发布时间】:2018-04-19 17:08:59
【问题描述】:
我正在使用 Visual Studio 创建 C++ 'Cli' /.Net 桌面应用程序,
并将我所有的测试结果作为字符串收集到一个列表中:
System::Collections::ArrayList^ lineList_type_err1 = gcnew System::Collections::ArrayList; // list of word
lineList_type_err1->Add("word list ");
lineList_type_err1->Add("|result 1 |");
lineList_type_err1->Add("|result 2 |");
lineList_type_err1->Add("|result 3 |");
lineList_type_err1->Add(" ");
但问题是每个单词都有自己的大小,我的信息太糟糕了。我想要一些方法来锁定类似于:
printf("\n| %-25s |","result 1");
printf("\n| %-25s |","result 2");
printf 中的大小被锁定为25,但我想这样做:
System::Collections::ArrayList^ ;
【问题讨论】:
-
非 C++ - 重新标记和编辑标题。
-
没有充分的理由与 printf() 搏斗。使用 Console::Write() 和复合格式。
-
我已经提到它是一个 c++ 桌面应用程序,我有文本框来显示结果,我没有使用控制台也有很多结果这就是我使用列表的原因
-
不是 C++ -- 将标签更改为“c++-cli”。
标签: asp.net .net visual-studio c++-cli desktop-application