[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
TurboCpp2006HelloWorld

(C++) (Turbo C++ 2006) Hello World

To create a Hello World program in Turbo C++ 2006 do the following:

  • Go to 'File | Close All' to close the default project
  • Do 'File | New | Other' to go to the 'New Item' menu
  • In the 'New Item' menu, select the 'Item Category' 'C++ Builder Projects'. In the right part, you can now double-click on 'Console Application'. Do so to start the 'New Console Application' dialog.
  • In the 'New Console Application' dialog, set 'Source Type' to 'C++', uncheck 'Use VCL', uncheck 'Multithreaded', check 'Console Application'. Then press OK to be taken to the Code Editor.
In the Code Editor you will see the code below:

//---------------------------------------------------------------------------
  1. pragma hdrstop
//---------------------------------------------------------------------------
  1. pragma argsused
int main(int argc, char* argv[]) { return 0; } //---------------------------------------------------------------------------


Change it to the code below:

//---------------------------------------------------------------------------
  1. include <iostream> //Added
  2. pragma hdrstop
//---------------------------------------------------------------------------
  1. pragma argsused
int main(int argc, char* argv[]) { std::cout << "Hello World" << std::endl; //Added return 0; } //---------------------------------------------------------------------------


Press F9 to start your Hello World program.

There are two notes:
  • The program will close automatically after displaying Hello World on the screen, as it will not wait for a key press
  • The code above is not standard.
To accomplish both, use the code below:

  1. include <iostream>
int main() { std::cout << "Hello World" << std::endl; std::cin.get(); //Wait for a key }


'Hello world' links



last edited (March 3, 2007) by bilderbikkel, Number of views: 1910, Current Rev: 2 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.