In the C programming language, there is an option to create an arc of a circle of a given radius with a given center coordinates and degree of the arc.The arc() function is used to create an arc. This arc function is included in graphics.h library in C which contains methods that can draw figures on the output screen.Syntaxvoid arc(int x, int y, int startangle, int endangle, int radius);Now, let's get deep into the function and understand each parameter passed and output returned by the function.Parametersx − type = int, function: defines the x coordinate of the center of the arc.y ... Read More
Anonymous entity is anything that is defined without a name. A class with no name provided is known as an anonymous class in c++. An anonymous class is a special class with one basic property.As there is no name given to the class there is no constructor allocated to it, though a destructor is there for deallocating the memory block.The class cannot be used as an element of a function i.e. you cannot pass it as an argument or cannot accept values return from the function.The syntax for defining an anonymous class in c++class { //data members // ... Read More
Aliquot sequence is a special sequence of numbers. The sequence starts from the number itself and the next number of the sequence is the sum of the proper divisors of the previous terms.Let’s take an example of the sequence to learn the concept better −Input : 8 Output : 8 7 1 0 Explanation : Proper divisors of 8 are 4, 2, 1. The sum is 7 Proper divisors of 7 are 1. The sum is 1 Proper divisors of 1 are 0. The sum is 0Perfect number is the number that has the aliquot sequence of ... Read More
Rational Numbers − A number that is expressed in the form of p/q. Given the condition that p and q both should be integers and q should not be equal to 0.Positive rational numbers are those numbers whose final values are positive. For this, either p and q both should be positive or p and q both should be negative.In this problem to generate positive random numbers up to a given number. We have to generate a finite number of positive rational numbers to n i.e. we will find rational numbers between 1 to n. For this algorithm, we will ... Read More
JavaScript programming language that is usually used for web scripting. It is a lightweight, interpreted programming language. JavaScript is one of the most programming languages for web development. For running JavaScript each browser has its own engine which enables the proper functioning of JavaScript in the browser. Some common Browsers and their JavaScript engines are −Spider Monkey for firefoxV8 for Google ChromeJavaScript code for SafariChakra for Microsoft Internet Explorer/ edgeTo make JavaScript universe and stop a browser from describing their own scripts. There is a standard set for JavaScript which will be used throughout the browser. there is an Association ... Read More
Before digging deep into the topics lets brush up all the related terms.A copy constructor is a special type of constructor that is used to create an object that is an exact copy of the object that is passed.A virtual function is a member function that is declared in the parent class and is redefined ( overridden) in a child class that inherits the parent class.With the use of a virtual copy constructor, the programmer will be able to create an object without knowing the exact data type of the object.In C++ programming language, copy Constructor is used to creating ... Read More
The replaceAll() method of the String class accepts two strings representing a regular expression and a replacement String and replaces the matched values with given String.Following is the regular expression to match the leading zeros of a string −The ^0+(?!$)";To remove the leading zeros from a string pass this as first parameter and “” as second parameter.ExampleThe following Java program reads an integer value from the user into a String and removes the leading zeroes from it using the Regular expressions. Live Demoimport java.util.Scanner; public class LeadingZeroesRE { public static String removeLeadingZeroes(String str) { String strPattern ... Read More
An interface in Java is similar to class but, it contains only abstract methods and fields which are final and static. Just like classes you can extend one interface from another using the extends keyword as shown below:interface ArithmeticCalculations { public abstract int addition(int a, int b); public abstract int subtraction(int a, int b); } interface MathCalculations extends ArithmeticCalculations { public abstract double squareRoot(int a); public abstract double powerOf(int a, int b); }In the same way you can extend multiple interfaces from an interface using the extends keyword, by separating the interfaces using comma (, ) ... Read More
When you have created an array of a particular data type with fixed size and populate it if you store a value other than its datatype an ArrayStoreException is thrown at the run time.ExampleIn the following Java program, we are creating an Integer array and trying to store a double value in it. Live Demoimport java.util.Arrays; public class ArrayStoreExceptionExample { public static void main(String args[]) { Number integerArray[] = new Integer[3]; integerArray[0] = 12548; integerArray[1] = 36987; integerArray[2] = 555.50; integerArray[3] = 12548; ... Read More
When you are working with collection objects, while one thread is iterating over a particular collection object, if you try to add or remove elements from it, a ConcurrentModificationException will be thrown.Not only that, If you are iterating a collection object, add or remove elements to it and try to iterate its contents again it is considered that you are trying to access the collection object using multiple threads and ConcurrentModificationException is thrown.Example Live Demoimport java.util.ArrayList; import java.util.Iterator; public class OccurenceOfElements { public static void main(String args[]) { ArrayList list = new ArrayList(); ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP