Found 7197 Articles for C++

iswdigit() function in C++ STL

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

146 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

151 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++

Aman Kumar
Updated on 29-Jul-2025 15:18:00

1K+ Views

The 3 Sum Closest problem involves finding the sum of three numbers in an array that is closest to a given target value. We are given an integer array nums of length n and an integer target. Our goal is to find three integers in the array such that their sum is as close as possible to the target using C++ program. In this task, we assume that each input has exactly one solution. If there are multiple sums equally close to the target, we return the maximum one. Let's consider the following example scenario to understand the problem more ... Read More

iswblank() function in C++ STL

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

139 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

466 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

6K+ 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

171 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

192 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

728 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

ZigZag Conversion in C++

Arnab Chakraborty
Updated on 27-Apr-2020 11:25:10

1K+ Views

Suppose the string is like " IWANTTOLEARNCODE". This string is written in a zigzag way on a given number of rows say n. So the pattern is looking like thisITAOWNOERCDALNEWhen we read the line like − "ITAOWNOERCDALNE"So we have to create one module that can perform this kind of operation by taking the string and the number of rows.To solve this, we will follow these stepswhen n = 1, then return screate an array of strings arr of size nrow := 0, and down := truefor i in range 0 to size of string – 1insert s[i] at the end ... Read More

Advertisements