Login
Password

Forgot your password?
Close

Create Your First C Plus Plus Program

By | 0 Comments | Rating: 0 | |

In this guide I'm going to show you how to create your first C++ program which includes the following steps

  1. Installing an IDE (Integrated Development Environment)
  2. Creating a new project
  3. Writing your first bit of code
  4. Compiling and running your code

So lets get started

Things You Will Need

In order to write your code you will need an IDE. This is where you do all your programming.
To get started get either Dev C++ by Bloodshed or Visual C++ Express Edition by Microsoft. Both are free and easy to get started with.

Step 1

Create a new project by going to File -> Project. The options will vary depending on the IDE but choose "empty project" and call it "HelloWorld"

Once you have your project opened you need a source file. This is where you type in the code. In Visual C++ you can right click on the source foler and go to Add -> New File the select a C++ file. The processis similar with Dev C++. Call the file main.cpp

Step 2

Now that you have your source file we can finally write some code.
Type the following into main.cpp

#include
using namespace std;

int main()
{
cout << "Hello, world!"
return 0;
}

Now in Visual C++ press F5 to compile and run the program and in Dev C++ preff Ctrl+F10.
If there are no errors then you should get a dos window that says "Hello, world!". If you get an error and check the code above and make sure you have copied it exactly as it is in cluding the ";".

That was a quick and dirty intro to C++. I have also done a more detailed version of this c++ hello world where I go through each line of code and explain why it's there and what it does. I will also be releasing more programming tutorials soon so go to Game With Me and subscribe to the newsletter or RSS feed.


Tips & Warnings





Comments

Add a new comment - No HTML
You must be logged in and verified to post a comment. Please log in or sign up to comment.





Thanks,

Ketan Patel

Explore InfoBarrel

Auto Business & Money Entertainment Environment Health History Home & Garden InfoBarrel University Lifestyle Sports Technology Travel & Places
© Copyright 2008 - 2012 by Hinzie Media Inc. Terms of Service Privacy Policy XML Sitemap