Found 26504 Articles for Server Side Programming

Functions in C/C++(3.5)

Sunidhi Bansal
Updated on 24-Apr-2020 11:55:57

249 Views

Functions are like a machine as they perform some functionality and produces a result of some type. Like, machine takes some input, process that input and produce an output similarly, function takes some value, operates on those value and produces the output. Manually a person passes the input to the machine then only the machine will start its functionality in the same manner when the programmer calls the function it will start executing.Functions can be different in name in various languages, but they share two common characteristics like −They contain sequence of instructions that needs to be processedThose instructions are ... Read More

Raw string literal in C++ program

Sunidhi Bansal
Updated on 22-Apr-2020 12:47:24

618 Views

In this article, we will be discussing the raw string literal in C++, its meaning, and examples.There are escape characters in C++ like “” or “\t”. When we try to print the escape characters, it will not display on the output. To show the escape characters on the output screen we use a raw string literal by using R”(String with escape characters)”. After using R in the front of the string the escape character will be displayed on the output.ExampleLet’s understand this with the help of an example Live Demo#include using namespace std; int main(){    string str = "tutorialspoint" ... Read More

Modulus function in C++ STL

Sunidhi Bansal
Updated on 22-Apr-2020 12:44:17

3K+ Views

In this article, we will be discussing the working, syntax, and examples of modulus functions in C++.What is modulus function C++?modulus function object class in C++, which is defined in header file. modulus function is a binary function object class used to get the result of the modulus operation of the two arguments. This function works the same as the operator ‘% ‘.Syntax of modulus functionTemplate struct modulus : binary_function {    T operator() (const T& a, const T& b) const {return a%b; } };Template parametersThe function accepts the following parameter(s) −T − This is the type of the ... Read More

logical_and in C++

Sunidhi Bansal
Updated on 22-Apr-2020 12:42:28

123 Views

In this article, we will be discussing the working, syntax, and examples of logical_and function object class in C++.What is logical_and?logical_and binary function is an inbuilt binary function object class in C++, which is defined in a header file. logical_and is a binary function used to give the result of logical “and” operation between two arguments.Logical AND is the binary operation that returns true only and only if both the binary values are true.Syntax of logical_andTemplate struct logical_and : binary_function {    T operator() (const T& a, const T& b) const {return a&b&; } };Template parametersThe function accepts the ... Read More

ilogb() function in C++ STL

Sunidhi Bansal
Updated on 22-Apr-2020 12:40:37

96 Views

In this article, we will be discussing the working, syntax, and examples of ilogb() function in C++.What is ilogb()?ilogb() function is an inbuilt function in C++ STL, which is defined in iostream> using namespace std; int main(){    int output, var = 2;    output = ilogb(var);    cout

imag() function in C++

Sunidhi Bansal
Updated on 22-Apr-2020 12:38:43

233 Views

In this article, we will be discussing the working, syntax, and examples of imag() function in C++.What is imag()?imag() function is an inbuilt function in C++ STL, which is defined in header file. imag() is used to find the imaginary part of the complex number.A complex number is a number which is made by the combination of a real number and an imaginary number. Real numbers are any number except the infinity and imaginary numbers.Imaginary numbers are those numbers whose square is a negative number. The function returns the imaginary part, the imaginary part which is the factor by which ... Read More

Last element of vector in C++ (Accessing and updating)

Sunidhi Bansal
Updated on 21-Feb-2025 16:28:57

1K+ Views

In this article, we will learn how to access and update the last element of a vector in C++. A vector in C++ is a dynamic array that can adjust its size automatically, allowing us to store and manage a collection of elements. Sometimes, we need to access or update the last element for tasks like changing data or performing calculations. Let's look at a simple example to better understand: Given a vector: std::vector vec = {10, 20, 30, 40, 50}; The last element of the vector is 50. If we want to update the last element to 100, ... Read More

remainder() in C++ program

Sunidhi Bansal
Updated on 22-Apr-2020 12:34:10

339 Views

In this article, we will be discussing the working, syntax, and examples of remainder() function in C++.What is remainder()?remainder() function is an inbuilt function in C++ STL, which is defined in header file. remainder() is used to find the remainder of the parameters.This function takes two arguments, one for the numerator and second for the and computes its remainder and returns a floating-point which is rounded to the nearest.This function computes −remainder = numerator – roundquot * denominator;In which “remainder” is the resulting numerator being the first argument and denominator is the second argument and roundquot is the rounded ... Read More

rand() and srand() in C/C++

Sunidhi Bansal
Updated on 22-Apr-2020 12:32:02

11K+ Views

In this article, we will be discussing the working, syntax, and examples of rand() and srand() function in C++ STL.What is rand()?rand() function is an inbuilt function in C++ STL, which is defined in header file. rand() is used to generate a series of random numbers. We use this function when we want to generate a random number in our code.Like we are making a game of ludo in C++ and we have to generate any random number between 1 and 6 so we can use rand() to generate a random number.The random number is generated by using an ... Read More

ratio_not_equal() in C++ with examples

Sunidhi Bansal
Updated on 22-Apr-2020 12:29:20

150 Views

In this article, we will be discussing the working, syntax, and examples of ratio_not_equal template in C++ STL.What is ratio_not_equal template?ratio_not_equal template is inbuilt in C++ STL, which is defined in header file. ratio_not_equal is used to compare the two ratios that are unequal. This template accepts two parameters and check whether the given ratios should not be equal. Like we have two ratios, 1/2 and 3/9 which are not equal so it stands true for the given template. This function returns true when the two ratios are unequal.So, when we want to check for the inequality of the ... Read More

Advertisements