Server Side Programming Articles

Page 1356 of 2109

is_class template in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 230 Views

In this article we will be discussing the working, syntax and examples of std::is_class template in C++ STL.is_class template is used to check whether the defined type is class type not any other type.What is a class?A class is an user defined data type or a data structure which contains some data members or member functions which is declared with the keyword ‘class’.Exampleclass abc {    int data_members;    void member_function(); };So, is_class template checks that the type T is a class, and returns the Boolean value true or false accordingly.Syntaxtemplate is_class;ParametersThe template can have only parameter of type ...

Read More

is_const Template in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 326 Views

In this article we will be discussing the working, syntax and examples of std::is_const template in C++ STL.is_const template in C++ is used to check whether the defined type is a const-qualified type or not.What is const-qualified type?We say a type as a const-qualified when the value of the type is constant. Constant data type is a type in which once a value is initialised in a const can’t be changed or altered throughout the program.Syntaxtemplate is_const;ParametersThe template can have only parameter of type T, and check whether the given type is a constqualifier or notReturn valueIt returns a ...

Read More

is_trivial function in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 236 Views

In this article we will be discussing the working, syntax and examples of std::is_trivial template in C++ STL.is_trivial is a template which comes under header file. This template is used to check whether the given type T is a trivial class or notWhat is a trivial class type in C++?We say a type as a Trivial type, when its data is stored in a contiguous manner and which accepts only static default initialization. It can include arrays of any type, classes and scalar type.Trivial class is a class which is trivially default constructed and trivially copyable. There are some ...

Read More

Customizing termination behavior for uncaught exception In C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 398 Views

In this tutorial, we will be discussing a program to customize behavior for an uncaught exceptions in C++.Usually, the exception is handled by the try-catch block, but there are instances where there isn’t a matching catch block and the program just terminates. This terminate() function is modifiable as per user requirements.Example#include #include using namespace std; //defining custom terminator void myhandler(){    cout

Read More

Different methods to reverse a string in C/C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 3K+ Views

In this tutorial, we will be discussing a program to understand different methods to reverse a string in C/C++.ExampleUser-defined reverse() function −#include using namespace std; //function to reverse given string void reverse_str(string& str){    int n = str.length();    for (int i = 0; i < n / 2; i++)       swap(str[i], str[n - i - 1]); } int main(){    string str = "tutorialspoint";    reverse_str(str);    cout

Read More

Does C++ compiler create default constructor when we write our own?

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 252 Views

In this tutorial, we will be discussing a program to understand if the C++ compiler creates a default constructor when we write our own.Generally, the C++ compiler uses the default constructor when no one is defined, but always uses the one defined by the user if any.Example#include using namespace std; class myInteger{ private:    int value;    //other functions in class }; int main(){    myInteger I1;    getchar();    return 0; }OutputCompiles successfullyExample#include using namespace std; class myInteger{    private:       int value;    public:       myInteger(int v) //user-defined constructor    { value = v; ...

Read More

Word Ladder in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 953 Views

Suppose we have two words (beginWord and endWord), and we have dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that −Only one letter can be converted at a time.In each transformed word must exist in the word list. The beginWord is not a transformed word.We have to keep in mind that −Return 0 when there is no such change sequence.All words have the same length.All words contain only lowercase characters.We can assume no duplicates in the word list.So if the input is like: beginWord = "hit", endWord = "cog", and wordlist = ["hot", ...

Read More

Extended Integral Types (Choosing the correct integer size in C/C++)

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 156 Views

In this tutorial, we will be discussing a program to understand extended integral types in C/C++.The data types in C are very loosely defined. Their range values changes on the basis of the compiler being 32 or 64 bit. To specify the compiler range you want to use in your program we use intN_t.Example#include using namespace std; int main(){    uint8_t i; //mentioning the bit to be 8    i = 0;    cout

Read More

Super Ugly Number in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 411 Views

We have to create one function to find the nth super ugly number. The super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. So if the n is 12 and primes are [2, 7, 13, 19], then the output will be 32, this is because [1, 2, 4, 7, 8, 13, 14, 16, 19, 26, 28, 32] is the sequence of 12 super ugly numbers.To solve this, we will follow these steps −Create a data structure triplet, with num, prime and idxif n is 1, then return 1, create ...

Read More

Delete elements in C++ STL list

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 295 Views

IIn this tutorial, we will be discussing a program to understand how to delete elements in the C++ STL list.For this, we will be using the pop_back() and pop_front() function to delete the element from last and the front respectively.Example#include #include using namespace std; int main(){    listlist1={10,15,20,25,30,35};    cout

Read More
Showing 13551–13560 of 21,090 articles
Advertisements