C++ Introduction - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript C++ Introduction - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript


Post Top Ad

Post Top Ad

Saturday, November 24, 2018

C++ Introduction

C++ Introduction

C++ introduction

C++ is a sophisticated, efficient and a general-purpose programming language based on C. It was developed at AT&T Bell laboratories in the early 1979s by Bjarne Stroustrup.
C++ is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. C++ is one of the most popular programming languages and is used in the the development of system software such as Microsoft Windows and Apllication Software such as devices drivers, embedded software, hogh performance servers and client applications.

C++ is an extension(superset) of C programming and the programs are written in C language can run in C++ compile. Many of today’s operating systems, system drivers, browsers and games use C++ as their core language. This makes C++ one of the most popular languages today.


 After studying this unit, you should be able to do the following:

  • explain basic concepts of Object Oriented Programming Language;
  • explain operator and their syntax in C++;
  • learn about C++ character set, tokens and basic data types;
  • identify the difference between implicit and explicit conversions;
  • explain about Input/Output streams supported by C++;
  • explain the structure of a C++ program;
  • write a simple program in C++; and
understand keywords used in C++ and control structure in C++.

Basic of C++

It is a deviation from traditional procedure language in the sense that it follows object oriented programming (OOP) approach which is quite suitable for managing large and complex programs.In this topic include these fundamentals; basic program constraints, variables,and Input/Output formats.

It contain the syntax and features of C language. It contain the same control statements; the same scope and storage class rules; and even the arithmetic, logical, bitwise operator and the data types are identical. C and C++ both the languages start with main function. The  object oriented feature in C++ is helpful in developing the large program with clarity, extensibility and easyto maintain the software after sale to customers


A token is a group of characters that logically combine together. The programmer can write a program by using tokens. C++ uses the following types of tokens:

  • Keywords
  • Identifiers
  • Literals
  • Punctuators 
  • Operators

Keywords are those words whose meaning is already defined by Compiler. These keywords cannot be used as an identifier. Note that keywords are the collection of reserved words and predefined identifiers. ts reserved words in C++ library and used to perform an internal operation. There are 60 key words currently defined for C++.

List of keywords

list of keywords



An identifier, in C#, is the user-defined name of a program element. It can be a namespace, class, method, variable or interface. Identifiers are symbols used to uniquely identify a program element in the code. They are also used to refer to types, constants, macros and parameters. 

A  C++ identifier is a name used to identify a variable, function, class, module, or any other user-defined item. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9).

Data types in C++

Data Types in C++ is used to define the type of data that identifiers accepts in programming  and operator are used to perform a special task such as addition, multiplication, subtaction, and divison etc of two or more operands during programming. Data types define the type of data a variable can hold, for example an integer variable can hold integer data, a character type variable can hold character data etc.

Data types in C++ are categorised in three groups: Built-in, user-defined and Derived.

C++ datatypes

What is the difference between C and C++?

The major difference between C and C++ is that C is a procedural programming language and does not support classes and objects, while C++ is a combination of both procedural and object oriented programming language; therefore C++ can be called a hybrid language. The following table presents differences between C and C++ in detail.

C Vs C++

Difference between C and C++
C was developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs.
C++ was developed by Bjarne Stroustrup in 1979 with C++'s predecessor "C with Classes".
When compared to C++, C is a subset of C++.
C++ is a superset of C. C++ can run most of C code while C cannot run C++ code.
C supports procedural programming paradigm for code development.
C++ supports both procedural and object oriented programming paradigms; therefore C++ is also called a hybrid language.
C does not support object oriented programming; therefore it has no support for polymorphism, encapsulation, and inheritance.
C does not support function and operator overloading.
C++ supports both function and operator overloading.
C does not allow functions to be defined inside structures.
In C++, functions can be used inside a structure.
Being an object oriented programming language C++ supports polymorphism, encapsulation, and inheritance.

Conclusion – Uses of C++

C++ uses

Uses of C++ is referred to as the safest language because of its security and features. It is the first language for any developer to start, who is interested in working in programming languages. It is easy to learn, as it is pure concept based language. Its syntax is very simple, which makes it easy to write or develop and errors can be easily replicated. Before using any other language, programmers preferred to learn C++ first and then they used other languages. But most of the developers try to stick with C++ only because of its wide variety of usage and compatibility with multiple platforms and software.

It is mainly used in applications and operating systems. The C++ language can beused for building higher-level applications with graphics libraries, applications to communicate with network devices and computer network simulators as well as remote device systems and network management.

Hello World in C++

#include <iostream>
int main(){
 std::cout<<"Hello World";
 return 0;

Open Your Editor and write the above code then write the below commands on terminal to execute the program

g++ hello.c

No comments:

Post a Comment

Post Top Ad