(a) Write a function julianday that takes as inputs integer m (themonth) and d (
ID: 3619111 • Letter: #
Question
(a) Write a function julianday that takes as inputs integer m (themonth) and d (the day) and output the number of days since January1. We assume this is not a leap year (no February 29). Forverification purpose again, julianday (1,1) = 0, julidanday (2, 5)= 35, julianday (5, 31) = 150, julianday (12,25) = 358. You shouldcall your julianday function from the main function. Use (4, 15)and (7, 4) as your test inputs here.(b) Enhance your julianday function to check invalid months such asm < 1 or m > 12 (output error message for this, and promptthe user to enter input again).
(c) Enhance your julianday function to check invalid days in avalid month such d = 30 for m = 2 (February 30?) or d < 1 for m= 2 (10%) Modify julianday function to have one more parameter year(the enhanced function is called enhjulianday (int y, int m, intd). This function will check if the year is a leap year and if so,set February to 29 days instead of 28 days. You will haveenhjulianday (2001, 12, 25) = 358, but enhjulianday (2000, 12, 25)= 359. Pointers and Strings
Explanation / Answer
please rate - thanks I don't understand why you would need strings #include using namespace std; int todoy(int,int,int); int leap(int); int main() { int month,day,doy,year,d; int days[12]={31,28,31,30,31,30,31,31,30,31,30,31}; coutmonth; while(month12) {coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.