C++ Conditional Statements

There come many situations when the programmer has to use C++ Conditional Statements to make decisions or has to execute statements based on some conditions. I this case, the For example, we need to process further only if there is a valid input by the user. This process is called decision making. Decision making structures … Read more

C++ Comments

Comments are the chunks of lines ignored by the compiler while compiling the code.  Comments are useful for understanding and explanation of the code. C++ allows single line as well as multiple line comments. Single Line Comments: If any line is pre-appended by double backslashes (//) then the line gets commented and compiler ignores such … Read more

C++ Encapsulation

C++ Encapsulation is a feature of object oriented programming OOP. Data encapsulation is the concept of binding data and methods in a single unit called class. Encapsulation means hiding some features of code from the user. Combining similar data like variables and functions in a single class helps to achieve encapsulation. A class is a … Read more

Categories C++

C++ Friendship and Inheritance

C++ Friendship is the feature of declaring classes or functions with friend keyword. The classes or functions declared with friend keyword have a relationship of friendship with the class. C++ Inheritance Inheritance and abstraction are major features of object oriented programming OOP. In OOP there are following access specifiers that help achieve inheritance. Public Protected … Read more

Categories C++

C++ Interfaces

C++ Interfaces are also a part of object oriented programming OOP. Interface represents the behavior of a class. That means interface can show the list of functions that a class performs. Abstract classes help us achieve the functionality of interfaces. Abstract classes are not related to Data Abstraction. Abstract classes help achieve C++ interfaces while … Read more

Categories C++

C++ Linked Lists

C++ linked list is a type of linear data structures that save dynamic data. Linked lists consists of nodes. Each node in a linked list connects to the nodes next to it. The implementation of linked list is based on pointers. The below diagram shows a linked list containing 4 nodes. Nodes are the base … Read more

C++ Variable Initialization

Whenever we need to store data in computer memory we have to use variables. Variables are actually the symbolic name of the location somewhere in the computer memory.  The variables can hold different values of same data type at different time during the execution of a program. There are many ways for C++ Variable initialization.  … Read more

Categories C++

C++ Operators

C++ Operators are special symbols that are used to operate different mathematical and logical operations. These operations are performed on variables and constants. These variables and constants are called Operands. Operators help to solve mathematical equations. There are different types of operators used in the C++ programming language. Following are their types: Assignment Operators Extended-Assignment … Read more

C++ File Handling

C++ programming language provides the capability to handle files through the code. Other than printing the results on the console programmer can also save results or read data from files. This is called C++ file handling. For this purpose, C++ programming language has fstream library. It is used along with iostream library. The syntax is: … Read more