What is the C++ Programming Language and Overview

Getting Started With C++

Introduction:-

C++ is a high-level programming language developed by Bjarne Stroustrup at AT&T Bell Laboratories in the early 1980s. Since C language was lacking in simulations and a bit of security as C language does not support Class and Objects feature which provide security to the programming languages. C++ is the update of C language so it is named as C++ by Rick Mascitti where ++ represent the increment operator in C language.

Frequently used terms:-

Header File – It is a file with extension .h which is used to link the program with predefined functions.

Variables – This word is used to represent a combination of alphabets and numbers to perform all operations.

Data Types- User defines variable along with their data type which represents the type of variable.

Functions- A segment of code defined to perform any operation any number of times.

Loops- Loops are the segment of code which automatically runs multiple numbers of times depending upon condition.

Conditional Statement- This segment of code executes only when the condition is satisfied.

Operators- Operators are used where some computation is required either mathematical computation or Boolean etc.

Keywords- this is the word which triggers some special meanings.

 

  1. Header Files:- Header Files contains the definition of Functions and Variables which can be imported and used by the user.

Commonly used header files:

Iostream:- this header file is used to import the definition of standard input and output functions i.e., cin and cout.

Conio.h:– commonly used to hold the screen and clear screen functions, i.e., clrscr() and getch() functions.

Stdio.h:– this header file holds the definition of macros and types required for standard I/O package i.e., scanf & printf.

String.h:- This header file is used for string manipulation i.e., strcmp, strcpy etc.

Math.h:- This header holds the definition of commonly used maths functions like sqrt, sinh etc.

Stdlib:- this header file is used for standard conversion, searching sorting etc.

  1. Variables:- Variables are used to provide named storage to all our inputs on which we need to perform operations.
  2. Data Types of variables:

Int- Integer type of variable which is used to hold integer values. It occupies 4 bytes of memory and ranges from -32,767 to 32,767.

Char- used to store a single character value. It occupies 1 byte of memory. It ranges from -127 to 127.

Float- it is used to store decimal type of variables. It occupies 4 byte of memory. It ranges from +/- 3.4e +/- 38 (~7 digits).

Double- it is used to represent a long range of integer value. It occupies 8 bytes of memory and ranges from +/- 1.7e +/- 308 (~15 digits).

  1. Functions:- Functions are of two types-
  2. Predefined Functions
  3. User defined functions
  4. Predefined Functions:- This type of functions are predefined and loaded into header files which can be imported and used by the user.

Examples:- sqrt(in math.h), strcpy(in string.h).

  1. User-defined Functions:- User can create his own segment of code as a function where user-defined operation will be performed and can be called multiple times.
  2. Loops:- Types of loops are:-
  3. For loop.
  4. Do-while loop.
  5. While loop.

These loops will be explained in further topics.

  1. Conditional statements:-

Types of conditional statements

  1. If-else
  2. Nested if
  3. Nested if-else
  4. Switch
  5. Jump

This topic will be further explained in a separate section.

  1. Operators:-

Types of operators:-

  1. Arithmetic operators:- +,-,=,*,/,% etc.
  2. Increment/Decrement operator:- ++/–
  3. Relational Operators:- <,>,<=(less than equals),>=(greater than equals),==(Equals),!=(Not equals).
  4. Logical operator:- &&(logical and),||(logical OR)
  5. Keywords:- Commonly used keywords are-

If, else, int, char, float, double, long, return, void, while etc.

By Bhoj Kumar

Sharing is caring 🙂

About Science Student 33 Articles
Read some interesting articles on ScienceStudent.net