passing reference parameters-function

I just do not know where to begin with this homework assignment- the exercise is : Write a function named yrCalc() that has an interger parameter representing the total number of days since the turn of the last century (1/1/1900) and reference parametrs named year, month, and day. The function is to calculate the current year, month, and day for the given number of days passed to it. Using the reference, the funtion should directly alter the respective actual arguments in the calling function. For this problem, assume that each year has 365 days and each month has 30 days.

This is what I know but not much of anything to write this program to compile.

#include <iostream>
using namespace std;

void yrCalc (double&, double&, double&);

int main()

(
double year, month, day

int numdays =

I do not know how to calculate the days or decide if I should set up an if statement or just cin entries

please help!!!
This should give you a start:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;

void yrCalc(int totalDays, int& year, int& month, int& day) {
    year = 1900 + totalDays / 365;
    totalDays -= year * 365;
    // ... calculate month and day ...
}

int main() {
    int year, month, day;
    yrCalc(40000, year, month, day);

    cout << year << " - " << month << " - " << day << endl;
}
Topic archived. No new replies allowed.