Found 7347 Articles for C++

iswlower() function in C++ STL

Sunidhi Bansal
Updated on 27-Feb-2020 05:35:46

58 Views

In C++ standard template library(STL), iswlower() function is used to check if the given wide character is in lowercase or not, if not then the function will return a zero value. The characters with ASCII value from 97 to 122 i.e. a-z are the lowercase alphabetic letters. Iswlower() function is present in cctype header file in C/C++.Syntax of iswlower () is as followsint iswlower (wint_t c)Parameters − c is a wide character to be checked, casted to a wint_t, or WEOF where wint_t is an integral type.Return Value − islower() function return non-zero value when the string is in lowercase ... Read More

iswdigit() function in C++ STL

Sunidhi Bansal
Updated on 30-Jan-2020 09:44:13

70 Views

In C++ STL, iswdigit() function is a built-in function that is used to check if the given wide character is a decimal digit character or some other character. This function is present in a cwctype header file in C/C++.What are the decimal digit characters?Decimal digit character are the numeric values that starts from 0 i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 .Syntax of iswcntrl() function is as followsint iswdigit() (wint_t c)Parameters − c is a wide character to be checked, casted to a wint_t, or WEOF where wint_t is an integral type.Return Value − A value ... Read More

iswcntrl() function in C++ STL

Sunidhi Bansal
Updated on 30-Jan-2020 09:59:01

85 Views

The iswcntrl () function in C++ standard template library(STL) is used to check if the given wide character is a control character or not. A control character is a character in C/C++ that won’t occupy a printing position on a display screen. Iswcntrl() function is defined in a cwctype header file.Syntax of iswcntrl() function is as followsint iswcntrl (wint_t c)Parameters − c − This is the character to be checked.Return Value − A value different from zero (i.e.. a non-zero value) if c is a control character else a zero value.Approach used in the below program is as followsInput the ... Read More

3Sum Closest in C++

Arnab Chakraborty
Updated on 27-Apr-2020 12:08:32

1K+ Views

Suppose we have an array nums with n integers and one target. We have to find three integers in nums such that the sum is closest to the target. We will return the sum of the three integers. We can take one assumption that each input would have exactly one solution. So if the given array is like [-1, 2, 1, -4] and the target is 1, then the triplet will be [-1, 2, 1] this has the closest sum, that is 2.To solve this, we will follow these steps −Sort the array nums, ans := 0, diff := Infinity, ... Read More

iswblank() function in C++ STL

Sunidhi Bansal
Updated on 27-Feb-2020 05:44:24

67 Views

The iswblank () function in C++ is used to check if the given wide character is blank not. It is present in “ctype.h” header file in C language and “cctype” header file in C++ Standard template library (STL).Syntax of iswblank is as followsint iswblank(wint_t ch)Return Type − returns non zero value if it contains blank spaces and value 0 if it doesn’t.Parameters − ch − This is the character to be checked.ExampleInput − string str = “I Love Myself”Output − total number of spaces is − 2Input − string str = “Myself”Output − total number of spaces is − 0Approach used ... Read More

Declare a C/C++ function returning pointer to array of integer function pointers

Sunidhi Bansal
Updated on 27-Feb-2020 05:41:36

409 Views

With given array the task is to create a function which will return pointer to an array of integer function pointers.For that we will input the two values and call a function which compares both the two values and functions pointer which return the memory address of bigger value and print it as a result. The function pointer is used to pass address of different function at different times thus making the function more flexible and abstract. So function pointers can be used to simplify code by providing a simple way to select a function to execute based on run-time ... Read More

Isupper() and Islower() and their application in C++

Sunidhi Bansal
Updated on 27-Feb-2020 05:48:09

5K+ Views

The functions isupper() and islower() in C++ are inbuilt functions present in “ctype.h” header file. It checks whether the given character or string is in uppercase or lowercase.What is isupper()?This function is used to check whether the given string contains any uppercase letter or not and also if we have one character as an input then it checks whether the character is in uppercase or not.Syntaxint isupper ( int arg)ExplanationThis function has return type as int as it returns non zero value when the string contains uppercase letter and 0 otherwise. It has one parameter which will contain the character ... Read More

DEQUE CBEGIN() in C++

Sunidhi Bansal
Updated on 30-Jan-2020 10:03:30

98 Views

Given the task is to show the working of deque::cbegin() in C++ STL.What is Deque::cbegin( ) function?deque::cbegin() is a function which comes under deque header file, cbegin() returns the iterator pointer which points to the first element of the deque container.Note − cbegin() function does not have any arguments in it.Syntaxdeq.cbegin();Where deq is the deque’s object.Return ValueThe function returns a const_iterator.const_iterator is a random access iterator which is used to point to the first element of the deque container. We can traverse the whole container using the first element of the container, but this can’t be used to do the ... Read More

DEQUE CRBEGIN() in C++

Sunidhi Bansal
Updated on 30-Jan-2020 07:42:23

115 Views

Given the task is to show the working of deque::crbegin() in C++.Deque is a double ended queue that gives insertion and deletion at each end i.e. front and back with high performance, in contrast to vector that gives high performance insertion at the end i.e. back only.Also, it provides random access to components too. Though one can insert part in between alternative components in dequeue with insert(), however its performance won't be sensible rather like a vector.What is deque::crbegin()?Deque::crbegin(), where crbegin is the constant reverse begin, implies it constantly reverse the begin or in other words it returns the constant_reverse_iterator.What ... Read More

String to Integer (atoi) in C++

Arnab Chakraborty
Updated on 27-Apr-2020 11:33:17

549 Views

Suppose we have to design a module, that first discards as many whitespace characters as necessary until the first non-whitespace character is reached. After that, starting from this character, it takes an optional initial plus sign or minus sign followed by as many numerical digits, and interprets them as a numerical value.When the first sequence of non-whitespace characters in str is not a valid integral number, or when no such sequence exists because either str is empty or it contains only whitespaces, no conversion will be performed.So if the input is like “-45”, the output will be -45.To solve this, ... Read More

Advertisements