Home > C++ > Getting Started With C++

Get Started

To start writing your very own code here are a few things that need to be done.

  • Set up a compiler to compile & run your code.
  • Learn C++ basics.
  • Start practicing/solving programming problems.

Setting up compiler: –

Before setting up a compiler you should know:
What is a compiler?
A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or “code” that a computer’s processor uses.
Different compilers are available for writing C++ programs which includes:

Other than these a complete List of C++ compilers can be found.
Let us set up our compiler.

  1. Download a latest version of Microsoft Visual studio.
  2. Run the installer.
  3. Install it to suitable directory.

Once it is installed open it and follow these steps.

  1. Go to file-> new-> project

  2. A new project pop up will be opened.

  3. Select visual c++.
  4. Win32 console application.
  5. Write your project name.
  6. Set its location.
  7. Click ok.
  8. A popup will be opened.
    click okay

  9. Click next.
  10. click next

  11. Click finish and you are all good to go.
  12. click finish

From here on you can start writing your programs.
Now add a simple code to check how it works.

#include "stdafx.h"

int main()
{ 
cout << "Welcome to our tutorials";
reurn 0;
}


Here we get an error that identifier “cout” is undefined as shown below.
error
To resolve this issue, we should include a header file iostream and a standard library namespace which includes cout.

#include "stdafx.h"
#include"iostream"

using namespace std;

int main()
{
  cout << "Welcome to our tutorials";
    return 0;
}

Inlcude header files
Now to compile this project first we should build it.
Go to Build -> Build Solution. Or press Ctrl+Shift+B from your key board.
build
When it is successfully built. You should see output that
Build Successful
Now it is time to run the compiled program.
Go to debug> start without debugging. Or simply press Ctrl+F5 from your keyboard.
start without debugging

When your program will run you should see the following output.
output
From now you can write your programs and run them on your compiler.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.