Question: How will I make a IPO chart for this C++ code? #include using std::cout; using std::endl; using std::cin; // function declaration void inputMDY (int &,

How will I make a IPO chart for this C++ code?

#include using std::cout; using std::endl; using std::cin; // function declaration void inputMDY (int &, int &, int &); // INPUT unsigned int calculateJDN (int, int, int); // PROCESSING void printJDN (int, int, int, unsigned int); // OUTPUT

// main function int main () { // declare the variables int month = 0; int day = 0; int year = 0; unsigned int JDN = 0; // call the inputMDY() function // to input the values from the user inputMDY (month, day, year); // process the input to calculate JDN JDN = calculateJDN (month, day, year); // print the JDN cout << endl; printJDN (month, day, year, JDN); }

// function to input the day, month and year // and return the same using call be reference // parameters to the function void inputMDY (int &m, int &d, int &y) { cout << "Enter a month number (Jan=1, Feb=2, etc.): "; cin >> m; cout << "Enter a day number (1..31) : "; cin >> d; cout << "Enter a year using four digits : "; cin >> y; }

// function to calculate the Julian day number and return it unsigned int calculateJDN (int m, int d, int y) { // declare the JDN variable to store the result unsigned int JDN = 0; // perform the intermediate calculations int a = (14 - m) / 12; m = (m - 3) + (12 * a); y = y + 4800 - a; int leap_days = (int) (y / 4) - (int) (y / 100) + (int) (y / 400); // do the main calculation and save the result in variable JDN JDN = (unsigned int) d + (((int) ((153 * m) + 2) / 5) + (365 * y) + leap_days - 32045); // return the result return JDN; }

// function to print the JDN with date void printJDN (int m, int d, int y, unsigned int JDN) { cout << "The JDN for " << m << "/" << d << "/" << y << " is: " << JDN << endl; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!