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
Programming Articles - Page 2004 of 3366
12K+ Views
readonly keywordreadonly keyword is used to define a variable which can be assigned once after declaration either during declaration or in constructor. const keyword is used to define a constant to be used in the program. Following is the valid usage of a readonly and const keywords in C#.Example Live Demousing System.IO; using System; public class Program { public const int VALUE = 10; public readonly int value1; Program(int value){ value1 = value; } public static void Main() { Console.WriteLine(VALUE); Program p1 = new Program(11); ... Read More
20K+ Views
Relational AlgebraRelational algebra is a procedural query language, which takes instances of relations as input and yields instances of relations as output. It uses operators to perform queries. An operator can be either unary or binary. They accept relations as their input and yield relations as their output. Relational algebra is performed recursively on a relation and intermediate results are also considered relations.The fundamental operations of relational algebra are as follows -SelectProjectUnionSet differentCartesian productRenameRelational CalculusIn contrast to Relational Algebra, Relational Calculus is a non-procedural query language, that is, it tells what to do but never explains how to do it.Relational ... Read More
267 Views
JShell is a command-line tool introduced in Java 9 that evaluates declarations, statements, and expressions without the main() method. JShell can set up a text editor called JShell Edit Pad, which allows us to modify the code very easily, and it can be launched using the "/edit" command.Below are the different "/edit" commands used in Jshell./edit /edit [ID] /edit [Code_Name]/edit: This command can be used without an argument, the "/edit" command displays all the active code in the text editor./edit [ID]: This command displays in the text editor the code corresponding to the ID entered./edit [Code_Name]: This comamnd displays in the ... Read More
413 Views
Java 9 introduced a new interactive tool called JShell. This tool can be used to execute expressions, classes, interfaces, enums, and etc.The detailed documentation can be available in JShell with full information, as well as the use of its internal commands with the various options. This documentation can be accessed using two commands: "/help" and "/?". JShell's documentation is not only limited to information regarding its internal controls, and also includes Javadoc.In the below code snippet, the result can be obtained by using the "/help" command.jshell> /help | Type a Java language expression, statement, or declaration. | Or ... Read More
302 Views
Flow API in Java 9 corresponds to Reactive Streams specification, which is a defacto standard. It contains a minimal set of interfaces that capture the heart of asynchronous publication and subscription.Below are the key interfaces of Flow API:1) Flow.Publisher: It produces items for subscribers to consume, and it contains only method: subscribe(Subscriber), whose purpose should be obvious.Syntaxvoid subscribe(Flow.Subscriber
445 Views
In this tutorial, we will be discussing a program to find circumference of a circle.For this we will be provided with the radius of the circle. Our task is to calculate and print the circumference of that circle.Example Live Demo#include using namespace std; #define PI 3.1415 double circumference(double r){ double cir = 2*PI*r; return cir; } int main(){ double r = 5; cout
598 Views
In this tutorial, we will be discussing a program to find the circumcenter of a triangle.For this we will be provided with three noncollinear points. Our task is to find the circumcenter of the triangle formed by those points.Example Live Demo#include #include using namespace std; //storing X and Y values #define pdd pair void lineFromPoints(pdd P, pdd Q, double &a, double &b, double &c){ a = Q.second - P.second; b = P.first - Q.first; c = a*(P.first)+ b*(P.second); } void perpendicularBisectorFromLine(pdd P, pdd Q, double &a, double &b, double &c){ pdd mid_point = make_pair((P.first + ... Read More
687 Views
In this tutorial, we will be discussing a program to find the century for a year.For this we will be provided with a year. Our task is to find the century in which the given year falls.Example Live Demo#include using namespace std; void find_century(int year){ //year values can only be positive if (year
256 Views
In this tutorial, we will be discussing a program to find area of a circular segment.Making a chord in a given sphere divides it into two segments - major and minor. Given the radius of the circle and angle making the minor segment, we are required to find the areas of both segments.Example Live Demo#include using namespace std; float pi = 3.14159; //finding area of segment float area_of_segment(float radius, float angle){ float area_of_sector = pi * (radius * radius)*(angle / 360); float area_of_triangle = (float)1 / 2 *(radius * radius) * sin((angle * pi) ... Read More
130 Views
In this tutorial, we will be discussing a program to understand partition_point in C++.Partition point is a method which returns an iterator pointing to the first value in a given range. The range is a partitioned one in which the predicate is not true.Example Live Demo#include #include #include bool IsOdd(int i) { return (i % 2) == 1; } int main(){ std::vector data{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::vector odd, even; std::stable_partition(data.begin(), data.end(), IsOdd); auto it = std::partition_point(data.begin(), data.end(), IsOdd); odd.assign(data.begin(), it); even.assign(it, data.end()); std::cout