
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 26504 Articles for Server Side Programming

456 Views
Problem StatementGiven two time periods in the string 'HH:MM: SS' format. Here 'HH' represents hours, 'MM' represents minutes and 'SS' represents seconds. Find the difference in the same string format between these two time periods.Time period 1 = 8:6:2 Time period 2 = 3:9:3 Time Difference is 4:56:59ExampleFollowing is the program in C++ to find the required output. Live Demo#include using namespace std; int main() { int hour1, minute1, second1; int hour2, minute2, second2; int diff_hour, diff_minute, diff_second; cout minute1 >> second1; cout minute2 >> second2; if(second2 > second1) { ... Read More

19K+ Views
out keywordout keyword is used to pass arguments to method as a reference type and is primary used when a method has to return multiple values. ref keyword is also used to pass arguments to method as reference type and is used when existing variable is to be modified in a method. Following is the valid usage of ref and out keywords in C#.Example Live Demousing System.IO; using System; public class Program { public static void update(out int a){ a = 10; } public static void change(ref int d){ d = 11; ... Read More

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

424 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

573 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

679 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

245 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

129 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

507 Views
In this tutorial, we will be discussing a program to understand pair in C++ Standard Template Library.Pair is a container defined in the utility header that contains two values. It is used to combine two values and associate them even if they are of different types.Example Live Demo#include #include using namespace std; int main(){ //initializing a pair pair PAIR1 ; PAIR1.first = 100; PAIR1.second = 'G' ; cout

237 Views
In this tutorial, we will be discussing a program to understand override keyword in C++.Override keyword is used to override the function in a base class and define a separate function with the same signature in the child class.Example Live Demo#include using namespace std; class Base { public: //function to be override virtual void func() { cout