- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7347 Articles for C++
647 Views
In this tutorial, we will be discussing a program to implement Linear Extrapolation.Extrapolation is defined as a process in which the required value for a certain function is beyond the lower or the upper limits of the function definition.In the case of Linear Extrapolation, the value beyond the scope is found using the tangent made on the graph of the function to determine the required value. Linear Extrapolation gives quite accurate results when applied.Example#include using namespace std; //structuring the values of x and y struct Data { double x, y; }; //calculating the linear extrapolation double calc_extrapolate(Data d[], ... Read More
330 Views
In this tutorial, we will be discussing a program to implement Inverse Interpolation using Lagrange formula.Inverse Interpolation is defined as the method of finding the value of an independent variable from the given value of dependent value lying between two tabulated set of values for an unknown function.Example#include using namespace std; //structuring the values of x and y struct Data { double x, y; }; //calculating inverse interpolation double calc_invinter(Data d[], int n, double y){ double x = 0; int i, j; for (i = 0; i < n; i++) { double ... Read More
351 Views
In this tutorial, we will be discussing a program to implement ASCII lookup table.ASCII lookup table is a tabular representation that provides with the octal, hexadecimal, decimal and HTML values of a given character.The character for the ASCII lookup table includes alphabets, digits, separators and special symbols.Example#include #include using namespace std; //converting decimal value to octal int Octal(int decimal){ int octal = 0; string temp = ""; while (decimal > 0) { int remainder = decimal % 8; temp = to_string(remainder) + temp; decimal /= 8; ... Read More
334 Views
In this tutorial, we will be discussing a program to implement Collatz Conjecture.For this, we will be given with a number n and we have to find out whether it can be converted to 1 using two operations −If n is even, n is converted to n/2.If n is odd, n is converted to 3*n + 1.Example#include using namespace std; //checking if n reaches to 1 or not bool check1(int n, unordered_set &s){ if (n == 1) return true; if (s.find(n) != s.end()) return false; return (n % 2)? check1(3*n + ... Read More
817 Views
In this tutorial, we will be discussing a program to get the sum of series 1 – x^2/2! + x^4/4! … upto nth term.For this we will be given with the values of x and n. Our task will be to calculate the sum of the given series upto the given n terms. This can be easily done by computing the factorial and using the standard power function to calculate powers.Example#include #include //calculating the sum of series double calc_sum(double x, int n){ double sum = 1, term = 1, fct, j, y = 2, m; int ... Read More
578 Views
In this tutorial, we will be discussing a program to generate random alphabets.For this, we will have a fixed size of array/string and use the rand() function to generate a random string of alphabets.Example#include using namespace std; const int MAX = 26; //generating a string of random alphabets string gen_random(int n){ char alphabet[MAX] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; string res ... Read More
655 Views
In this tutorial, we will be discussing a program to generate CAPTCHA and verify user.For this, we will provide the user with a random string and ask him to reenter the same string. Then it has to be checked if the given and the input string matches.The CAPTCHA should be completely random system generated consisting of a-z, AZ and 0-9.Example#include using namespace std; //checks if the strings are same bool check_string(string &captcha, string &user_captcha){ return captcha.compare(user_captcha) == 0; } //generates a random string as Captcha string gen_captcha(int n){ time_t t; srand((unsigned)time(&t)); char *chrs = "abcdefghijklmnopqrstuvwxyzABCDEFGHI" "JKLMNOPQRSTUVWXYZ0123456789"; ... Read More
4K+ 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
2K+ 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
511 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