Sean's Note: [C++/CLI] Input & Ouput

2010年1月9日 星期六

[C++/CLI] Input & Ouput

Input
字串:String^ line = Console::ReadLine();
字元:char ch = Console::Read();
數字:int value = Int32::Parse(Console::ReadLine());
鍵盤:ConsoleKeyInfo keyPress = Console::ReadKey(true); // true 即 No Display, flase 即 Display

Ouput
int packageCount = 1;
float packageWeight = 7.5;
Console::WriteLine(L"Packages:{0,3} Weight: {1,5:F2} pounds.", packageCount, packageWeight);
{n,w : Axx}: n - arg, w - field width, A - formatted, xx - precision

沒有留言:

張貼留言