C++ tutorial-first program


Your First Program with C++


Before you continue to the next page of the C++ tutorial, you should create a simple first program. To create the first program, you will need to open text editor—Notepad and type the following C++ code:

#include<iostream>
using namespace std;

int main()
{
   cout << "Hello World\n";
   return 0;
}

In Dev-C++ editor, to develop the C++ program, you will follow the steps below.

-Go to File menu, select New. Then select Project...

-On the new project window, select Console Applicaiton and enter the name of the project in the Name text box. Then click OK to create the project.

creating a new project in Dev-C++ 

- It will prompt you to the save the project. Please save the project. Then you will get the code block as shown below.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{


   system("PAUSE");
   return EXIT_SUCCESS;
}

-You won't need to remove this existring code block. Simply you will write the line of code: cout << "Hello World\n"; above the system("PAUSE"); statement.




Comments

dean comment

 dean

How would you run the program in notepad?


2016-11-27



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.