Calculating Julian Day Number (JDN) using C++

What is Julian Day Number Julian Day is the continuous number of days since the beginning of the Julian period and is mainly used by astronomers and in software to easily calculate past days between two events (eg, food production date and sales by date). Code #include<iostream> #include <limits> using namespace std; void input_data(int &month, int &year, int &day,int &bmonth, int &byear, int &bday); void calculations(int month, int year, int day, int &jdn); void output_results(int &month, int &year, int &day, int &jdn,int d); void calculate_dow(int &jdn , int &dow); void calculate_difference_and_print(int jdn , int bjdn); void pause(); int main() { int bday; int bmonth; int byear; int bjdn; int day; int month; int year; int jdn; int dow; int bdow; input_data(month, year, day,bmonth, byear, bday); // calculate JDN for the present day calculations(month, year, day, jdn); // calculate JDN for the Date of birth calculations(bmonth, byear, bday, bjdn); calculate_dow(jdn,dow); calculate_dow(bjdn,bdow); cout << endl; output_results(month, year, day, jdn,dow); output_results(bmonth, byear, bday, bjdn,bdow); calculate_difference_and_print(jdn,bjdn); pause(); } void pause(); // this module is changed to increase the functionality void input_data (int &month, int &year, int &day,int &bmonth, int &byear, int &bday) { std::cout << "enter a month(jan = 1, feb = 2, etc....

April 27, 2019 · 3 min · Rahul Rajput

Bubble Sort code in C

Bubble sort is the simplest Sorting algorithm available. It works by repeatedly swapping the adjacent or neighbor element if they are in the wrong order. Working Actually in first pass bubble sort sets the largest element to its position, in the second pass algorithm sets the second largest element this continues till the list or array is not finally sorted. Here is the example image. To work with the algorithm you first have to understand what is swapping and how it is done....

January 25, 2019 · 2 min · Rahul Rajput

Distributed Systems AKTU (UPTU) lab program

Distributed system DS is the subject mandatory subject in the seventh semester of the final year of Computer Science in Dr. APJ Abdul Kalam Technical University. Lab practical Questions. Assignment 1 Assignment 2 Assignment 3 Assignment 4 For the completed Answer of these assignments are in the link given below. Answers Thanks for being here. Subscribe to this blog for more post like this.

January 3, 2019 · 1 min · Rahul Rajput

Keywords, Comments & Variable, Introduction to C

About this Series Welcome everybody, you must be interested in learning about the programming. Guess what, you’re at the correct place. In this series we will learn about how to in and out of C language from very basics of programming to a pretty intermediate level. This post mainly contains the keywords, comments and variables in C. If you wanted to take a look at history of C then checkout my previous post in this series....

January 2, 2019 · 3 min · Rahul Rajput

Introduction to C language

About this Series Welcome everybody, you must be interested in learning about the programming. Guess what, you’re at the correct place. In this series we will learn about how to in and out of C language from very basics of programming to a pretty intermediate level. This post mainly contains the history of C language with introduction to its creator. So lets pack your bag and come with me on a learning trip....

January 2, 2019 · 3 min · Rahul Rajput

How to Create Linked List in C/C++

##Source Code #include <stdio.h> #include <stdlib.h> struct Node{ int data; struct Node *next; }; typedef struct Node *node; node createNewNode(){ node temp; temp = (node)malloc(sizeof(struct Node)); // allocate memory equal memory as the size using malloc() temp->next = NULL;// make next point to NULL (suppose this as last node) return temp; } node addNode(node head, int value){ node tmp,p; tmp = createNewNode(); tmp->data = value; if(head == NULL){ head = tmp; } else{ p = head; while(p->next !...

January 2, 2019 · 1 min · Rahul Rajput

Blackjack Console game program in Python

Blackjack Game Blackjack is the American variant of a globally popular banking game known as Twenty-One. Game Rules One player have to make the total sum of his hands lower than 21 to win while another player has the total sum is 21 or more, Cards greater than or equal to 10 are considered as the 10, Ace can be considered as the 11 or 1 depending on conditions. Person who scored less will be announced as winner, considering there must be one person whose score should be more than 21....

December 26, 2018 · 3 min · Rahul Rajput