Brief Description: Given an array A, we have to rotate the array in the right direction by K steps. Let’s begin with an example. A = [1,2,3,4,5,6,7,8,9,10] and K = 3, then if we rotate the array in the right direction by K times, the resultant array would look like…
Category: C++
C++ program to demonstrate simple inheritance
This program will demonstrate the simple inheritance in C++. Inheritance is the capability of a class to derive properties and characteristics from another class. Inheritance is an important concept in OOPS. More about inheritance its modes and types can be found here https://www.geeksforgeeks.org/inheritance-in-c/ . In the below code we will…
Classes and Objects
Classes and Objects Classes and Objects: Class is a user defined data type just like Structures, but with the difference. It also has 3 sections namely 1. private, 2. public and 3. protected. Using these, access to member variable of a class can be strictly controlled. public : variable and…
Inline function in c++
INLINE FUNCTION INLINE FUNCTION: The inline function is the concept used commonly with classes. When the function is inline, the compiler places a copy of the code of that function at each point. Conditions for the Inline function: Inline functions should not contain any loops, recursion. – The inline…
C++ : Read array of 10 Integers and Display
Read array of 10 integers and displaying them. “Array is the limited storage(as size mentioned) with ordered series or arrangement of same kind of data(int or float or char)” Example :Input is asked as : Enter the Array elements, Enter Values like 00,10,20,30,40,50,60,70,80,90 are stored in particular space of array.…
C++ Program to Swap two numbers.
“Swapping of integers is defined as the variables that are interchanged after swapping the variables,called as Swapping of integers” Example: If the input is given as a=5 and b=4 (before Swapping) The output will be as a=4 and b=5 (after Swapping). Input: a=20 and b=40, before swapping. Output:…
C++ Program to find whether the number is Palindrome or not.
“Palindrome number defined as the number in which the result is same hen the number/digit/result is reversed”. Example: 1. 52325. 2. GADAG. 1. Here in example 1. we can see that 5,2 is mentioned at first and center number is 3, where as last two numbers are…