Ajay yadav

Ajay yadav

38 Articles Published

Articles by Ajay yadav

Page 4 of 4

Remove vowels from a String in C++

Ajay yadav
Ajay yadav
Updated on 29-Nov-2019 5K+ Views

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 is added to the new string after the string ends we copy the new string into the original string. The algorithm is as follows;AlgorithmSTART    Step-1: Input the string    Step-3: Check vowel presence, if found return TRUE    Step-4: Copy it to another array    Step-5: Increment the counter ...

Read More

Validate IP Address in C++

Ajay yadav
Ajay yadav
Updated on 29-Nov-2019 3K+ Views

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 the purpose of identifying a host machine in the network in a unique manner in order to establish a connection among them.So, in order to validate the correct IP address input from the user-end, the following algorithm briefs how exactly the code sequence is materialized to identify the correct IP ...

Read More

Replacing words with asterisks in C++

Ajay yadav
Ajay yadav
Updated on 29-Nov-2019 758 Views

This aim of this program to replace a particular word with asterisks in the string by using the c++ programming code. The essential function of vector and string class essay a key role to achieve the prospective results. The algorithm is as follows;AlgorithmSTART    Step-1: Input string    Step-2 Split the string into words and store in array list    Step-3: Iterate the loop till the length and put the asterisk into a variable    Step-4: Traverse the array foreah loop and compare the string with the replaced word    Step-5: Print ENDNow, the following code is carved out based ...

Read More

Replacing space with a hyphen in C++

Ajay yadav
Ajay yadav
Updated on 29-Nov-2019 2K+ Views

In this C++ program, the space in the string will be replaced with the hyphen. Firstly, the length of the string is determined by the length() function of the cstring class, then hyphen is filled into the space of the sentence by traversing the string as follows.Example Live Demo#include #include using namespace std; int main(){    // raw string declaration    string str = "Coding in C++ programming";    cout

Read More

Sqrt, sqrtl, and sqrtf in C++ programming

Ajay yadav
Ajay yadav
Updated on 29-Nov-2019 365 Views

Math ClassThis article demonstrates the usage of math class essentials functions sqrt(), sqrtl(), and sqrtf() to calculate the square root of double, long, and float type variables with precision respectively. The Math class of C++ offers a wide range of functions to calculate mathematical calculations including sin, cos, square root, ceil, floor, etc..It is, therefore, mandatory to import the definition of header class library in the program in order to avail all calculative methods.Sqrt MethodThe double sqrtl () method of the Math class returns the square root of a double variable with precision. The syntax of this function is ...

Read More

Swap Upper diagonal with Lower in C++

Ajay yadav
Ajay yadav
Updated on 29-Nov-2019 384 Views

This tutorial is designed to swap the upper row of a three-diagonal array to its lower one using c++ code. Moreover, if a three-diagonal array is an input, the coveted results must be something like that as;For this, the course of action is briefed in the algorithm as follows;AlgorithmStep-1: Input a diagonal array Step-2: Pass it to Swap() method Step-3: Traverse the outer loop till 3 Step-4: increment j= i+ 1 in the inner loop till 3 Step-5: put the array value in a temp variable Step-6: interchange the value arr[i][j]= arr[j][i] Step-7: put the temp data to arr[j][i] Step-8: ...

Read More

Toggle all characters in the string in C++

Ajay yadav
Ajay yadav
Updated on 29-Nov-2019 980 Views

This program translates the characters of a string into uppercase. However, this task can be easily achieved by using the toUpper() method of the c++ class library. But in this program, we perform this by calculating the ASCII value of characters in uppercase. The Algorithm is as follows;AlgorithmSTART    Step-1: Declare the array of char    Step-2: Check ASCII value of uppercase characters which must grater than A and lesser than Z    Step-3: Check ASCII value of lower characters which must grater than A and lesser than Z ENDThe toggleChar() method gets the array of characters as an input. ...

Read More

Write a program for Happy Woman’s Day in c++

Ajay yadav
Ajay yadav
Updated on 29-Nov-2019 508 Views

The woman day which is celebrated on 7th October worldwide is carved into a c++ programming code as following;Example#include using namespace std; int main(){    // Initializing size of    // design    int n = 5;    // Loop to print Circle    // (Upper part of design)    // Outer loop to    // control height of    // design    for (int i = 0; i

Read More
Showing 31–38 of 38 articles
« Prev 1 2 3 4 Next »
Advertisements