Mega Code Archive

 
Categories / Visual C++ .NET / Data Type
 

{ 0, -30 } 30 characters in width, left-justified

#include "stdafx.h" using namespace System; int main() {    String^ format = "{0,-30}{1,10}{2,10:c2}";    String^ header = String::Format(format, "Item", "Quantity", "Price");    String^ str1 = str1->Format(format, "M", 10, 0.99);    String^ str2 = str2->Format(format, "G", 1, 12.50);    String^ str3 = str3->Format(format, "I", 1, 4.99);    Console::WriteLine(header);    Console::WriteLine(str1 + "\n" + str2 + "\n" + str3); }