C++

C++ originated from C language is one of the most popular high languages and forms an integral part of many of the prevalent operating systems including Apple’s OS X and various versions of Microsoft Windows, and the erstwhile Symbian mobile OS. It is a really faster language (around 100 times than python).
Before starting learning c++ we have to set up the environment to use c++. Either you can use an IDE such as code blocks or visual studio etc or you can just you a text editor like notepad++, sublime text but you have to set up compiler separately. I will prefer to use code blocks for windows and Linux. you can also use Xcode for mac.

To download code blocks paste this link in your browser

http://www.codeblocks.org/downloads/26

How to Install

I guess you can install code blocks on your own as it is not a complicated task…
so now let’s begin with our first program…

Click on file -> New -> Project -> Console application and just click next, enter your project name and you are done.

Note:- You can run your project using play icon in the toolbar or pressing F9 key. Remember to build your project before running it. other options you can explore yourself in code blocks ide.

Now your First program is already built in the editor. So let’s try to understand what is happening. First, we are importing already made libraries and using these libraries we are performing tasks like printing output and getting input, performing various operations.

Code

#include  <iostream>// 1st line

using namespace std; // 2nd line

int main() // 3rd line
{

// printing statement
cout << “Hello idiots” << endl
}

  • 1st line:- It is telling the computer to import iostream library using which we will print something on a screen or get input from the user.
  • 2nd line:- You might not understand namespace right now. So I am gonna skip it this time.
  • 3rd line:- considering main() as a function in which you organize your program like how it will start, what operations your program will perform or how your program will end.
    (note:- this is not the actual definition of main. but this is the only definition you can understand right now).

Check this also: GTA 6 upsets Xbox One and PS4 Users

printing statement:- “cout” (pronounced as “C-out”) is used to print something on the screen. << operator tells a computer to put everything on right to left function i.e. cout. (you don’t need to understand << right now but just remember how to use it)

So our first program is ready. just play with a little and enjoy.

Note:- find what “//” and “endl” means in the code on your own.

Follow Techistaan to get unbiased gadgets reviews and latest tech updates.

LEAVE A REPLY

Please enter your comment!
Please enter your name here