
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

346 Views
Here we will see what are the differences for set, multiset, unordered_set and unordered_multiset in C++. Let us see the properties of them using some example.SetThe properties of set are like belowStores data in sorted orderStores only unique valuesWe can insert or delete data, but cannot change the dataWe can remove more than one element using start and end iteratorWe can traverse using iteratorsSets are implemented using Binary Search TreeNow let us see an exampleExample#include #include using namespace std; main() { int data[15] = {11, 55, 22, 66, 33, 22, 11, 44, 77, 88, 66, 99, 66, 23, 41}; set my_set; for(int i = 0; i

162 Views
To find the factorial of a large number, we can use the boost library. This library provides high precision numbers. Using boost multiprecision library we can get more precision than 64 bits.Example#include #include using boost::multiprecision::cpp_int; using namespace std; cpp_int Large_Fact(int number) { cpp_int fact = 1; for (int i = 1; i > fact >> endl; }Output9332621544394415268169923885626670049071596826438162146859296389521759999322 9915608941463976156518286253697920827223758251185210916864000000000000000000 000000

4K+ Views
The function overriding is the most common feature of C++. Basically function overriding means redefine a function which is present in the base class, also be defined in the derived class. So the function signatures are the same but the behavior will be different.But there may be a situation when a programmer makes a mistake while overriding that function. Like if the signature is not the same, then that will be treated as another function, but not the overridden method or that. In that case, we can use the override keyword. This keyword is introduced in C+ +11. When the ... Read More

168 Views
The sizeof function (Sometimes called operator) is used to calculate the size of the given argument. If some other functions are given as argument, then that will not be executed in the sizeof.In the following example we will put one printf() statement inside the loop. Then we will see the output.Example#include double my_function() { printf("This is a test function"); return 123456789; } main() { int x; x = sizeof(printf("Hello World")); printf("The size: %d", x); x = sizeof(my_function()); printf("The size: %d", x); }OutputThe size: 4 The size: 8The printf() is not executed which is ... Read More

66 Views
The feclearexcept() function is used to clear the supported floating point exceptions represented by the excepts.This function returns 0, if all exceptions are cleared, or the exception value is 0. And returns nonzero value for some exceptions.To use this function, we have to enable the FENV_ACCESS. This will give our program to access the floating point environment to test the exception raised.Example#include #include #include #pragma STDC FENV_ACCESS on using namespace std; main() { feclearexcept(FE_ALL_EXCEPT); sqrt(-5); if (fetestexcept(FE_INVALID)) cout >> "sqrt(-5) will generate FE_INVALID" >> endl; }Outputsqrt(-5) will generate FE_INVALIDRead More

5K+ Views
The static_cast is used for the normal/ordinary type conversion. This is also the cast responsible for implicit type coercion and can also be called explicitly. You should use it in cases like converting float to int, char to int, etc. This can cast related type classes.Example#include using namespace std; int main() { float x = 4.26; int y = x; // C like cast int z = static_cast(x); cout >> "Value after casting: " >> z; }OutputValue after casting: 4If the types are not same it will generate some error.Example#include using namespace std; class Base ... Read More

3K+ Views
In this section, we will see how to check whether a given character is number, or the alphabet or some special character in C.The alphabets are from A – Z and a – z, Then the numbers are from 0 – 9. And all other characters are special characters. So If we check the conditions using these criteria, we can easily find them.Example#include #include main() { char ch; printf("Enter a character: "); scanf("%c", &ch); if((ch >= 'A' && ch = 'a' && ch = '0' && ch

2K+ Views
Here we will see the kbhit functionality in C. The kbhit is basically the Keyboard Hit. This function is present at conio.h header file. So for using this, we have to include this header file into our code.The functionality of kbhit() is that, when a key is pressed it returns nonzero value, otherwise returns zero.Example#include #include main() { char ch; printf("Enter keys (ESC to exit)"); while (1) { //define infinite loop for taking keys if (kbhit) { ch = getch(); // Get typed character into ch ... Read More

7K+ Views
Here we will see how to count number of objects are created from a specific class using some static member functions. The static members are class properties, not the object properties. For a single class there will be only one instance for static members. No new members are created for each objects.In this problem we are using one static counter variable to keep track the number of objects, then static member will be there to display the count value.When a new object is created, so the constructor will be called. Inside the constructor, the count value is increased. Thus we ... Read More

7K+ Views
Python functions can return multiple values. These values can be stored in variables directly. A function is not restricted to return a variable, it can return zero, one, two or more values.This is the default property of python to return multiple values/variables which is not available in many other programming languages like C++ or Java.For returning multiple values from a function, we can return tuple, list or dictionary object as per our requirement.Method 1: Using tupledef func(x): y0 = x+ 1 y1 = x * 3 y2 = y0 ** 3 return (y0, y1, y2)However, above ... Read More