C++ Loops

Loops Quite often there comes a situation when a programmer needs to repeat a piece of code multiple times. Why is Repetition Needed? Repetition provides following purposes: Duplication Taking input, sum, and average of multiple numbers using a limited number of variables For example, to add five numbers we may have two different algorithms: Declare … Read more

C++ Arrays

C++ arrays store one or more than one element. An array contains a number of items. A single variable is used to define an array of multiple items. Each item in an array is called an element. The image below shows an array that has 10 elements. Hence the length of array is 10. The … Read more

C++ Strings

C++ Strings are of two types: C++ String class C-Style Character String C++ String class Strings is one of the most common data types used in C++ programming language. String type variables store characters in double quotes. They are objects of string class that is part of standard C++ library. In order to use string … Read more

C++ Functions

C++ Function is a piece of code that performs specific tasks. Functions can run multiple times by calling them in code. They may or may not have a return value. Any C++ code must have at least one function. In C++ programming language functions provide code reusability. There are two types of functions in C++ … Read more

C++ Structures

C++ Structures store variables having different data types. For instance, n C++ programming language, user sometimes faces a situation where he needs to store a collection of various types of data in a single entity. Arrays provide the functionality to store data having same data types. Whereas for saving data of different data types, Structures … Read more

C++ Pointers

C++ Pointers are variables that store memory address of another variable. In C++ programming language, each variable that user declares, has a specific memory allocation. To access these memory locations programmers user pointers. The syntax for declaring a pointer is: Asterisk sign (*) represents the pointers. It is called the Deference operator. Here pointer_type is … Read more

C++ Constants

Constants C++ Constants are actually like fixed variables. Their value is declared in the beginning and cannot be altered afterward. In the C++ programming language, Constants are basically fixed values. These values are unchangeable throughout the program. These are also called Literals. C++ Constants Data types C++ constants have the same data types as C++ … Read more

C++ References

C++ References refer to another variable. Reference variables act as reference to already existing variables. This means that a single variable can be called in two ways. One way is calling it by its own name and in second way calling by its reference variable. Create C++ Reference & operator is used to create reference … Read more