
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

737 Views
The following is an example to catch a divide by zero error.Example Live Demo#include using namespace std; int display(int x, int y) { if( y == 0 ) { throw "Division by zero condition!"; } return (x/y); } int main () { int a = 50; int b = 0; int c = 0; try { c = display(a, b); cout

2K+ Views
To calculate the execution time of a program, use the std::chrono library, which was introduced in C++11. This library has two distinct objects: time_point and duration. The time_point represents the variable names that store the start and end times of specific algorithms, functions, or loops used in the program. While duration represents the interval between two different times. The chrono library allows us to subtract these time intervals. Here, we use the high_resolution_clock::now() function, which provides accurate units of time. Calculate the Execution Time of a C++ Program To get the execution time of a program use the chrono header ... Read More

10K+ Views
Enumeration is a user defined datatype in C/C++ language. It is used to assign names to the integral constants which makes a program easy to read and maintain. The keyword “enum” is used to declare an enumeration. The following is the syntax of enums. Syntax enum enum_name{const1, const2, ....... }; Here, enum_name − Any name given by user. const1, const2 − These are values of type flag. The enum keyword is also used to define the variables of enum type. There are two ways to define the variables of enum type as follows. enum colors{red, black}; enum suit{heart, diamond=8, ... Read More

147 Views
The main() function is the entry point of every C++ program where execution begins. It is invoked automatically when the program is executed. The main() function returns the execution status to the operating system (indicating whether the program executed successfully or not). You can also use optional command-line arguments, argc and argv, to pass values to the program. Declaration /Prototype of main() The standard prototype of main() function is as follows: int main() { body } Or, int main(int argc, char *argv[]) { body } Here, argc : Number of arguments passed to the program from the environment ... Read More

13K+ Views
In Python, there is a module called Decimal, which is used to do some decimal floating point related tasks. This module provides correctly-rounded floating point arithmetic. To use it at first we need to import it the Decimal standard library module. import decimal In this section we will see some important functions of the Decimal module. The square root function sqrt() and Exponent function exp() The sqrt() method is used to calculate the square root of a given decimal type object. And the exp() method returns the e^x value for the given x as Decimal number. Example Code ... Read More

503 Views
In this section we will see how to create the website alarm system using Python. Problem Statement Open a website URL on the browser by taking a website URL and time. When the system time reaches the specified time, the webpage will be opened. We can store different web pages in our bookmark sections. Sometimes we need to open some web pages every day on a specific time to do some work. For that purpose, we can set this type of website alarm to do the work. In this case we are using some standard library modules like sys, web ... Read More

863 Views
In this problem, we will see how Python can do some Morphological Operations like Erosion and Dilation using the OpenCV module. The OpenCV library is mainly designed for computer vision. It is open source. Originally it was designed by Intel. This is free to use under open-source BSD license. To use the OpenCV functionality, we need to download them using pip. sudo pip3 install opencv-python What is Erosion Image and how it works? In the Erosion, it erodes away the boundaries of foreground objects. It is used to remove small white noises from the images. Erosion can also ... Read More

2K+ Views
Here we will see how Python can be used to get the Round Trip Time (RTT). The RTT is the time which is taken by the entire trip of a signal. It means the time between the starting time when a signal is sent and the receiving time of the acknowledge signal.The RTT results varies on different parameters like.The data transfer rate of the sender’s side.The nature of the transmission media.The actual distance between the sender and receiver.The number of nodes between sender and receiver.The amount of traffic on LAN.Number of requests handled by intermediate points.Example Codeimport time import requests ... Read More

2K+ Views
The speech recognition is one of the most useful features in several applications like home automation, AI etc. In this section we will see how the speech recognition can be done using Python and Google’s Speech API. In this case we will give an audio using microphone for speech recognizing. To configure the microphones, there are some parameters. To use this module, we have to install the SpeechRecognition module. There is another module called pyaudio, which is optional. Using this we can set different modes of audio. sudo pip3 install SpeechRecognition sudo apt-get install python3-pyaudio For External Microphones ... Read More

813 Views
In this section we will see how to create a birthday reminder application using Python. Problem Statement Create an application using Python, which can check whether there is any birthday on the current day or not. If it is the birthday of some listed person, send a notification to the System with the name of that person. We need a file, where we can store the date and month and the name of the person as a lookup file for this application. The file will look like this − Here we will convert this application to a start-up application ... Read More