 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
Programming Articles - Page 2614 of 3366
 
 
			
			17K+ Views
C++ has no direct method to check one object is an instance of some class type or not. In Java, we can get this kind of facility.In C++11, we can find one item called is_base_of. This will check if the given class is a base of the given object or not. But, this does not verify whether the given class instance uses that function. The nearest possible functionality similar to "instanceof" can be achieved using dynamic_cast (expression). This tries to covert the given value into the specified type and returns the result. if the cast is unsuccessful this returns a null ... Read More
 
 
			
			160 Views
In C++, there are some undefined behaviors. These are identified by doing some tasks in C++. There are no such direct definitions. These few things should be known to all of the programmers, who want to use C++ for different purposes.Here we will see some C++ Codes. and try to guess the results. The codes will generate some runtime errors.The Divide By Zero error is undefined.Example Code#include using namespace std; int main() { int x = 10, y = 0; int z = x / y; cout
 
 
			
			458 Views
Here we will see some good tricks of C++ programming language that can help us in different area. Like if we want to participate in some competitive programming events, then these tricks will help us to reduce the time for writing codes. Let us see some of these examples one by one.Checking whether a number is odd or even without using % operator. This trick is simple. We can perform bitwise AND operation with the number and 1. If the result is non-zero then this is odd, otherwise this is even. The logic is too simple. All odd numbers have ... Read More
 
 
			
			254 Views
Zooming digits means printing the digits of a given number in an enlarged form using special characters. In this article, we will learn to print (display) enlarged (zoomed) form of the digits of a given number. Below is the representation of digits 01438 in zoom format, Example of Zoom Digits in Integers Form To generate the zoomed digit, we define the pattern logic for each digit based on its respective function prototype. Then, we create a function that sets the switch-case logic which processes the selected digit based on either user input or a given number. In this example, ... Read More
 
 
			
			255 Views
In this program we will count the number of ways one number can be represented by sum of numbers smaller than itself. This program will count the partition of given numbers. We take a number n as input, then starting from a number break it by removing 1 at a time. If the new partition is generated, increase the counter.AlgorithmpartitionCount(n)Input : The number nOutput : The number of partitionsBegin Create array p of size n k := 0 count := -1 put n as the first element of array p Repeat the following steps, do ... Read More
 
 
			
			694 Views
In this section we will see how to find the area of a triangle in 2D coordinate space using matrix determinants. In this case we are considering the space is 2D. So we are putting each points in the matrix. Putting x values at the first column, y into the second and taking 1 as the third column. Then find the determinant of them. The area of the triangle will be half of the determinant value. If the determinant is negative, then simply take the absolute value of it.$$Area\:=\:absolute\:of\begin{pmatrix}\frac{1}{2} \begin{vmatrix} x_1\:\:y_1\:\:1 \ x_2\:\:y_2\:\:1 \ x_3\:\:y_3\:\:1 \end{vmatrix} \end{pmatrix}$$Here we are assuming ... Read More
 
 
			
			908 Views
In C++, the templates are used to create generalized functions and classes. So we can use any type of data like int, char, float, or some user defined data also using templates.In this section, we will see how to use the template specialization. So now we can define some generalized template for different types of data. And some special template function for special type of data. Let us see some example to get better idea.Example Code#include using namespace std; template void my_function(T x) { cout
 
 
			
			2K+ Views
Templates are the foundation of generic programming, which involves writing code in a way that is independent of any particular type.A template is a blueprint or formula for creating a generic class or a function. The library containers like iterators and algorithms are examples of generic programming and have been developed using template concept.There is a single definition of each container, such as vector, but we can define many different kinds of vectors for example, vector or vector .Example Code#include #include using namespace std; template inline T const& Max (T const& a, T const& b) { ... Read More
 
 
			
			2K+ Views
We can arrange the characters of a string in different order. Here we will see how we can count the number of permutations can be formed from a given string.We know that if one string is ‘abc’. It has three characters; we can arrange them into 3! = 6 different ways. So a string with n characters, we can arrange them into n! different ways. But now if there are same characters are present for multiple times, like aab, then there will not be 6 permutations.abaaabbaabaaaababaHere the (1, 6), (2, 5), (3, 4) are same. So here the number of ... Read More
 
 
			
			22K+ Views
In order to call an interface method from a java program, the program must instantiate the interface implementation program. A method can then be called using the implementation object.Examplepublic interface InterfaceDemo{ default public void displayNameDefault(String name){ System.out.println("Your name is : " + name); } public void displayName(String name); public void displayNameAndDesignation(String name, String designation); }The above interface defines three methods for displaying a name and optionally a job title. One method is a default method that contains implementation logic. The remaining two methods do not include implementation logic.public class InterfaceDemoImpl ... Read More