点点滴滴的比较
程序代码:
#include "stdafx.h" #include <iostream> using namespace System; int main(array<System::String ^> ^args) { int apples,oranges; int fruit; apples = 5; oranges = 6; fruit = apples + oranges; Console::WriteLine(L"\noranges are not the only fruit..."); Console::Write(L"- and we have "); Console::Write(fruit); Console::Write(L" fruits in all.\n"); int packageCount = 25; /*Console::Write(L"There are "); Console::Write(packageCount); Console::WriteLine(L" packages.");*/ Console::WriteLine(L"There are {0} packages.", packageCount); //一句顶 3 句 double packageWeight = 9.5; Console::WriteLine(L"there are {0} packages weight {1} pounds.",packageCount,packageWeight); Console::WriteLine(L"there are {0} packages weight {1:F2} pounds.",packageCount,packageWeight); Console::WriteLine(L"there are {0,3} packages weight {1,5:F2} pounds.",packageCount,packageWeight); system("pause"); return 0; }
这是世界上最笨的学习方法!没有老师教,只好这样学。