This "Hello World" console application demonstrates the essential steps for creating a Windows application in Delphi or C++. The application uses Windows, a console window, an event, and will display a dialog in response to a user action.
To create the "Hello world" console application
- Create a Windows console application.
- Create the logic.
- Run the application.
To create a Windows console application
- Choose FileNewOther.... The New Items dialog box appears.
- In the New Items dialog box, select either Delphi Projects or C++Builder Projects and then double-click Console Application.
- For C++, in the New Console Application dialog box, make sure that VCL Forms and Multi-threaded are unchecked, and Console application is checked. Then click OK.
To associate code with the console window
- In the code template that is displayed in the Code Editor: For Delphi, enter the following statements after the try keyword and before the except keyword:
WriteLn('Hello, World!');
ReadLn;
For C++, enter the following after #pragma hdrstop:
- For C++, enter the following code after the opening brace ({):
std::cout<<”Hello, World!”<<std::endl;
std::cin.ignore();
- Save the application.
To run the "Hello World" application
- Choose RunRun. The application compiles and displays a console window with your "Hello World" message.
- Press the ENTER key. The console window closes when the program terminates.