C++ Articles - Page 440 of 717

forward_list::swap( ) in C++ STL

Sunidhi Bansal
Updated on 28-Feb-2020 06:47:19

210 Views

Given is the task to show the working of forward_list::swap( ) function in C++.What is a Forward List?Forward list is a sequence container that allow constant time insert and erase operations anywhere within the sequence. Forward list are implement as a singly-linked lists. The ordering is kept by the association to each element of a link to the next element in the sequence.What is forward_list::swap()?forward_list::swap( ) is a function in c++ standard library function which is used to swap the contents of one list to another list of same size and same data type.Syntaxforward_list1.swap(forward_list2)Orswap(forward_list first, forward_list second)ExampleOutput – First list ... Read More

forward_list::unique( ) in C++ STL

Sunidhi Bansal
Updated on 28-Feb-2020 06:42:16

256 Views

Given is the task to show the working of forward_list::unique( ) function in C++.Forward list are sequence containers that allow constant time insert and erase operations anywhere within the sequence. Forward list are implement as a singly-linked lists. The ordering is kept by the association to each element of a link to the next element in the sequence.forward_list::unique( ) is a function in c++ standard library function which is used to remove the all duplicate elements from forward list. Notice that an element is only removed from the forward_list container if it compare equal to the element immediately it. Thus, ... Read More

hypot( ), hypotf( ), hypotl( ) in C++

Sunidhi Bansal
Updated on 28-Feb-2020 06:30:08

263 Views

In this article we will be discussing the working, syntax and examples of hypot( ), hypotf( ), hypotl( ) function in C++.hypot( ) functionThis function is used to compute the hypotenuse of a right angled triangle. This function returns the square root of sum of square of two variables. It is a function of header file.What is hypotenuse?Hypotenuse is the longest side of the right angle triangle. Below is the graphical representation of a hypotenuse in a right angle triangle.In above figure AC side of the triangle is a hypotenuse.The formula to calculate hypotenuse is −$$H = \sqrt{x^2+Y^2}$$SyntaxData type ... Read More

real( ) function in c++

Sunidhi Bansal
Updated on 28-Feb-2020 06:19:23

2K+ Views

Given is the task to the working of real( ) function in C++.This function is used to find the real part of the complex number. This function return the real part of the complex number and sets the real part to value. And real returns the real component. The real( ) function is the function of header file.In complex number a+Bi , the Bi is a imaginary part and A is the Real part of the complex number.Return − It returns the real part of the specified complex number.SyntaxTemplate Y Real(constant complex& X);Parameters − The parameter X which represents ... Read More

iswxdigit() function in C++ STL

Sunidhi Bansal
Updated on 28-Feb-2020 06:15:21

124 Views

In this article we are going to discuss the iswxdigit() function in C++, its syntax, working and its return values.iswxdigit() function is an inbuilt function in C++ which is defined in header file. The function checks whether the passed wide character is a hexadecimal character or not. The function checks the if argument passed is hexadecimal character then return a non-zero integer value(true), else return zero(false).A hexadecimal character is any character which is among the following −0 1 2 3 4 5 6 7 8 9 A B C D E FSyntaxint iswxdigit(wint_t ch);The function accepts only one parameter, i.e. ... Read More

iswupper() function in C++ STL

Sunidhi Bansal
Updated on 28-Feb-2020 06:13:17

131 Views

In this article we are going to discuss the iswupper() function in C++, its syntax, working and its return values.iswupper() function is an inbuilt function in C++ which is defined in header file. The function checks whether the passed wide character is in upper case(A-Z) or not.This function is a wide character equivalent of isupper(), which means it works the same as isupper() the difference is it supports a wide character. The function checks the if argument passed is upper case(A-Z) then return a non-zero integer value(true), else return zero(false)Syntaxint iswupper(wint_t ch);The function accepts only one parameter, i.e. a wide ... Read More

iswspace() function in C++ STL

Sunidhi Bansal
Updated on 28-Feb-2020 06:09:48

203 Views

In this article we are going to discuss the iswspace() function in C++, its syntax, working and its return values.iswspace() function is an inbuilt function in C++ which is defined in header file. The function checks whether the passed wide character is a white space character or not.This function is a wide character equivalent of isspace(), which means it works the same as isspace() the difference is it supports a wide character. The function checks the if argument passed is a white space (‘ ‘) then return a non-zero integer value(true), else return zero(false)Syntaxint iswspace(wint_t ch);The function accepts only one ... Read More

iswpunct() function in C++ STL

Sunidhi Bansal
Updated on 28-Feb-2020 06:07:18

151 Views

In this article we are going to discuss the iswpunct() function in C++, its syntax, working and its return values.iswpunct() function is an inbuilt function in C++ which is defined in header file. The function checks whether the passed wide character is a punctuation character or not. This function is a wide character equivalent of ispunct(), which means it works the same as ispunct() the difference is it supports a wide character. So, the function checks if the argument passed is punctuation character then return any non zero integer value(true), else it will return zero(false)Punctuation characters are as follows! ... Read More

difftime() function in C++

Sunidhi Bansal
Updated on 28-Feb-2020 06:02:09

234 Views

In this article we are going to discuss the difftime() function in C++, its syntax, working and its return values.difftime() function is an inbuilt function in C++ which is defined in header file. The function accepts two parameters of time_t type, function calculate the difference between the two timesSyntaxdouble difftime(time_t end, time_t beginning);Return valueReturns the difference of the time in seconds, stored as double data type.Example Live Demo#include #include int main () {    time_t now;    struct tm newyear;    double seconds;    time(&now); /* get current time; */    newyear = *localtime(&now);    newyear.tm_hour = 0; newyear.tm_min ... Read More

isunordered() function in C++

Sunidhi Bansal
Updated on 28-Feb-2020 05:58:15

78 Views

In this article we are going to discuss the isunordered() function in C++, its syntax, working and its return values.isunordered() function is an inbuilt function in C++ which is defined in header file. The function checks whether the two floating points number be NAN, if both or either one of them is NAN then it will return 1(true) else will return 0(false).Syntaxbool isunordered(float n1, float n2);orbool isunordered(double n1, double n2); orbool isunordered(long double n1, long double n2);The function accepts two floating point variables to compare and check if either one of these is nan.Return valueThe function return the boolean value ... Read More

Advertisements