
- Select Visual C++ CLR Console Application, name it CLRConsole, and click OK.

- It's easy to notice on the auto-generated source code, CLRConsole.cpp:
: The parameters passed to main() is (array<System::String ^> ^args). To know more about "^", refer to the post ^ (Handle to Object on Managed Heap).
: The output using Console::, not cout.
: The 'L' in front of "Hello World" indicate that it's wide-character string.

- Modify to add following code before return, to make the program pause before exit.
Console::ReadLine();
// CLRConsole.cpp : main project file.
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
Console::ReadLine();
return 0;
}
- Save and Run.
No comments:
Post a Comment