Ajay yadav has Published 48 Articles

Reverse a String (Iterative) C++

Ajay yadav

Ajay yadav

Updated on 23-Dec-2019 06:24:14

There are many ways defined to reverse a string in the C++ code including stack, In-place, and iteration. In this sample, a simple string will be reversed iteratively with the following algorithm;AlgorithmSTART    Step-1: Input the string    Step-2: Get the length of the string using length() method    Step-3: ... Read More

Reverse an array in C++

Ajay yadav

Ajay yadav

Updated on 23-Dec-2019 06:21:32

The article showcase an array to be reversed in descending order using the C++ coding wherein the highest index is swapped to lowest index consequently by traversing the array in the loop.Example Live Demo#include #include using namespace std; void reverseArray(int arr[], int n){    for (int low = 0, ... Read More

Reverse a string using the pointer in C++

Ajay yadav

Ajay yadav

Updated on 23-Dec-2019 06:14:43

This article reverse a string using the pointer in C++ coding, First, it calculates the length of a pointer to string then run a for loop in decrement order to display the reverse string as follows;Example Live Demo#include #include using namespace std; int main(){    char *str="ajaykumar";    coutRead More

Sort an Array of string using Selection sort in C++

Ajay yadav

Ajay yadav

Updated on 23-Dec-2019 06:09:48

The Selection Sort algorithm sorts an exhibit by more than once finding the base component from the unsorted part and putting it toward the start. In each emphasis of determination sort, the base component from the unsorted subarray is picked and moved to the arranged subarray.Example Live Demo#include #include ... Read More

Sorting string in Descending order C++

Ajay yadav

Ajay yadav

Updated on 23-Dec-2019 06:06:53

The sorting in ascending or descending order, however, can duly be performed by using string sort method and other means too in the C++ programming. But here, the string compare (first words with the second) and copy (copy the first word in a temp variable) method involved in the inner ... Read More

stable_sort() in C++ STL

Ajay yadav

Ajay yadav

Updated on 23-Dec-2019 06:03:30

The stable_sort method of STL first sorts the components with name as the key in ascending order and afterward the components are arranged with their segment as the key. Moreover, The stable_sort() calculation is viewed as steady in light of the fact that the overall request of comparable components is ... Read More

Stein’s Algorithm for finding GCD in C++

Ajay yadav

Ajay yadav

Updated on 23-Dec-2019 06:01:17

Stein's Algorithm used for discovering GCD of numbers as it calculates the best regular divisor of two non-negative whole numbers. It replaces division with math movements, examinations, and subtraction. In the event that both an and b are 0, gcd is zero gcd(0, 0) = 0. The algorithm for GCD(a, ... Read More

Stringstream in C++ programming

Ajay yadav

Ajay yadav

Updated on 23-Dec-2019 05:36:07

This sample draft calculates the total number of words in a given string as well as counts the total occurrence of a particular word using stringstream in the C++ programming code. The stringstream class partners a string object with a stream enabling you to peruse from the string as though ... Read More

Remove vowels from a String in C++

Ajay yadav

Ajay yadav

Updated on 29-Nov-2019 11:13:00

The following C++ program illustrates how to remove the vowels (a, e, i, u, o) from a given string. In this context, we create a new string and process input string character by character, and if a vowel is found it is excluded in the new string, otherwise the character ... Read More

Validate IP Address in C++

Ajay yadav

Ajay yadav

Updated on 29-Nov-2019 11:08:26

This article is serving the purpose of validating the correct IP (internet protocol) address by virtue of C++ code programming. The IP address is a 32-bit dot-decimal-notation, broken into four decimal numbers segments ranging from 0 to 255. Furthermore, these numbers are separated by dots consecutively. The IP address serves ... Read More

Advertisements