C++ Tutorial

C++ Introduction C++ is an object-oriented programming language. It was developed by Bjarne Stroustrup at AT&T Bell Laboratories. It is superset (extension) of C programming language. Depending upon features supported by programming languages, they are classified into two different categories: …

Read moreC++ Tutorial

C++ History

C++ is a middle-level programming language developed in 1980s by Bjarne Stroustrup at Bel Labs. C ++ development initially started in 1979, four years before its launch. It is started with name C with Classes not C++. In the end part of 1983, C …

Read moreC++ History

C++ Installation

Let’s install C++ setup to start programming in C++. C++ setup contains C++ compiler which is required in your system. There are lots of C++ compilers available, you must choose according to your compatibility. List of C++ Compiler For Windows: …

Read moreC++ Installation

C++ First Program

Let’s write a simple basic program structure of C++, its compilation and its execution (how it runs). This program is compiled using GCC compiler. Open any editor to write C++ program.

Output of above program

Compile and Run …

Read moreC++ First Program

C++ cin and cout

C++ Standard Input/Output C++ standard input/output operations are performed to flow bytes stream from keyboard (input device) to main memory and from main memory to display screen (output device) respectively. The input/output are done using standard libraries provided by C++. …

Read moreC++ cin and cout

C++ Data type

Data type in every language is very important. Data type means the different kind of data which are supported by a particular programming language. C++ programming language supports various kinds of data types. C++ data types are broadly classified into …

Read moreC++ Data type

C++ Variable

C++ variable are used to store data in memory location. The value stored in variable may be changed depends on program execution. Each variable in programming language has its own specific types. These specific data types determine the size and …

Read moreC++ Variable

C++ operator

An operator is specially a symbol that tells compiler to perform specific manipulation. C++ contains various different types of operators. Types of C++ Operators Arithmetic Operators Logical Operators Relational Operators Assignment Operators Bitwise Operators Misc. Operators Arithmetic Operators Arithmetic operators …

Read moreC++ operator

C++ Keywords

Keywords are explicitly reserved identifier of C++ language features. It cannot be used as user-define program elements or other name for the program variables. C++ programming language has several reserved keywords used in program. ANSI C++ also uses the keywords available …

Read moreC++ Keywords

C++ OOPs Concepts

C++ Object-Oriented Programming Concepts C++ uses the concept of object-oriented programming. Object Oriented Programming has some prominent features: Object Class Data abstraction Encapsulation Polymorphism Inheritance Message passing Object An object is the basic unit of object-oriented programming. It is a real-time …

Read moreC++ OOPs Concepts

C++ If

C++ Control Statement C++ control statement or decision-making statement is used to control the flow of program statement according to condition applied.   C++ if Control Statement An if control statement in C++ is used to control the flow of program statement …

Read moreC++ If

C++ Nested if

C++ nested if Control Statement Nested if control statement refers to if condition within if condition. C++ compiler checks nested if control statement when its parent if condition returns true, then the program is executed according to nested if condition. Syntax

Example

Output

← Prev Next→

C++ if-else

C++ if else Control Statement if else control statement in C++ is used to control the program flow in a two-way direction. When condition returns a true value, then the program executes if condition block otherwise program executes else block. Syntax:

C++ if else Example

Read moreC++ if-else

C++ If-else-if

C++ if.. else if Control Statement if.. else if control statement is an if statement used with an optional else if control statement to check multiple conditions. In this control statement, when any one of condition returns true, then none of the other else if or else will be …

Read moreC++ If-else-if

C++ Switch

C++ switch Control Statement The switch control statement allows checking the variable for equality against a list of values. The switch statement checks an integer, char or enumerated type in its condition expression. It does not take any floating variable in its condition expression. Syntax

Read moreC++ Switch

C++ Break

C++ break Statement The break statement is used to alter the normal flow of a program. The break statement terminates a loop (for, while and do..while) and switch statement instantly where it applied. When a break statement is applied inside the nested loop, it only affects (breaks) the inner loop. Syntax …

Read moreC++ Break

C++ Continue

C++ continue Statement The continue statement forces to iterate the loop instantly without executing the next statement of the loop. Sometimes it is required to skip certain test condition within the loop, in such case continue statement is applied. When continue statement is applied inside the nested loop, …

Read moreC++ Continue

C++ Goto

C++ goto Statement A goto statement is used to jump the flow of a sequence of program execution. It transfers the control to some other part of the program. The goto uses an identifier that encountered the control of program jumps to an identifier. …

Read moreC++ Goto

C++ For loop

C++ loop Statement A loop statement allows us to repeat the execution of a statement or group of statements multiple times. The statement(s) repeat execution within loop until the condition of loop became false. There are three types of loops in C++ …

Read moreC++ For loop

C++ While loop

C++ while Loop Statement The while loop is an iterative control statement. A while loop repeatedly executes loop’s statement(s) several times as a given condition is true. Execution of loop is terminated when the condition of while loop becomes false and execute code after the …

Read moreC++ While loop