Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you please write a C++ program in codeblocks for this program? Thank you. 6.

ID: 3594490 • Letter: C

Question

Can you please write a C++ program in codeblocks for this program?

Thank you.

6. (Practice) Write a function named yearcalc() that has an integer parameter representing the total number of days from the date 1/1/2000 and reference parameters named year, month, and day. The function is to calculate the current year, month, and day given the num- ber of days passed to it. Using the reference parameters, the function should alter the argu- ments in the calling function. For this problem, assume each year has 365 days, and each month has 30 days.

Explanation / Answer

#include <bits/stdc++.h>

using namespace std;
int yearCalc(int number){
// reference month
int year=2000;
int month=1;
int date=1;
  
int cyear=number/365;
number=number%365;
  
int cmonth=number/30;
int cdate=number-4*30;
year+=cyear;
month+=cmonth;
date+=cdate;
if (date>30){
month+=1;
date=date-30;
}
if (month>12){
year+=1;
year-=12;
}

cout<<"year"<<"/moth"<<"date"<<endl;
cout<<year<<"/"<<month<<"/"<<date;
  
}
int main() {
int number;
cout<<"Enter the Number";
cin>>number;
yearCalc(number);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote