C++ Programming: Introduction to C++

Tuesday, October 30, 2018

Introduction to C++


Hello friends, you’re welcome to our C++ programming tutorial blog. In this tutorial you are familiar with oops concept. If you are a beginner in programming world then this is the right blog for you. 

And in this tutorial you will be told about each basic concept so that you can learn C++ well. Our purpose is to make you a good programmer by clearing your concepts.


 Introduction to C++ 


C++ is an extended version of C programming language. It is a free form language was developed by Bjarne Stroustrup. It has imperative and object-oriented features. It should be also written as c plus plus (cpp).
  
 C++ have similar attributes like syntax and semantics and it is implemented with the object oriented features such as classes and objects ,inheritance, polymorphism and overloading concept to C. It is a middle level language.

C++ can be used to make operating systems, system software, device drivers, games, compilers, databases or application software’s and many more. C++ is a completely free and runs on various platforms such as UNIX, Windows OS, Mac OS, etc.

 It is faster and more powerful than other object-oriented languages .This all features makes C++ one of the most popular and widely used programming languages today.


History of C++ 

The C++ programming languages was developed by Bjarne Stroustrup in 1979 at Bell Laboratories which is located in USA. In 1979, when he doing his PhD thesis then he motivated for creating a new programming language. Stroustrup took the two languages (Simula 67 and BCPL) and started work on both of them.

 Finally, he found that Simula had features that were very helpful for large software development which is independent of hardware. But Simula is too slow for maintenance and for practical use.

 Shortly thereafter, Then he began to work on C and initially introduced “C with Classes”. He chooses C language because it provides portability, speed, low level functionality as well as high level functionality. This all features satisfy the paradigm of idea of his new language. His new language include with classes, polymorphism, inheritance.

The ++ operator in the C language is an operator for incrementing a variable and Stroustrup gave new name to C is C++ language. It is intended as an incremental improvement of C. In 1998, the C++ standards Committee published the First International Standard for C++ ISO/IEC 14882:1998, which would be known as C++98.

Features of C++ 

  1.    It is general purpose programming language which is used to make             big or complex softwares.
  2.      Statically typed 
  3.      Free form language
  4.      Case-sensitive 
  5.      Multi-paradigm
  6.      Object oriented programming plays very important role in education            also.
  7.     It supports low level as well as high level language.

Learn C++ programming

Follow this programming tutorial if you want to be learning programming. So, now let’s start coding.
Before you start, you need to install any text editor or compiler in your PC or laptop to run C++ programs. If you want to quick start use online compilers.


How to install code::blocks on Windows (XP,Vista 7, 8, 10) 


To make this installation of code::blocks, follow this step by step guide.

  1.    Go to code::blocks official website and then go to downloads section.          As seen in below figure.


How-to-install-code-blocks-in-windows



  2.    Go to Binaries .


How-to-install-code-blocks-in-windows


  3.    Scroll down and choose windows platform.


How-to-install-code-blocks-in-windows


  4.    And then download. After downloading install the code blocks in your
      PC or Laptop.

   Your First C++ Program 



  1.       #include<iostream.h>       // include header file
  2.        Int main()
  3.       {
  4.        cout << “Hello World!”;   // print Hello World! onto screen
  5.        return 0;
  6.        }


Now try to understand the above program. The whole program is divided into six lines.

    1.    What is #include<iostream.h> ?

#include is the preprocessor command. Iostream header file contains the declaration input (cin) and output (cout) instructions.

#include tells the compiler to include the content of iostream file in the program.

    2.    What is Comment?

In first line of program the double slash // is the comment symbol. The double slash comment is basically used for single line comment.

 For multiline comments used  /*   */  which are still valid
 in C++.

     3.    What is int main() ?

 main() is the main function of program and int is the return type of main      function.

Note: - Execution of any program always starts with main function.

     4. { }

The code inside the braces { } is called the body of main().

     5.    cout << “Hello World!”;

cout is an output instruction. cout is a predefined object and represents the standard output in cpp.

 The declaration of cout is present in the header file. It is used to print the statements. The operator << is the insertion operator.

     6.    Semicolon”;”

The semicolon is a sign of terminations. It terminates a statement.

     7.    What is return 0; ?

This statement means the main function returns value zero to the OS. It isn’t compulsory to return something every time.

In the other words return 0 is basically the sign of fine execution of program.


Note: - main function in any program should return any value.










No comments:

Post a Comment

Introduction to C++

Hello friends, you’re welcome to our C++ programming tutorial blog. In this tutorial you are familiar with oops concept. If you are a be...