Please help, I do not understand the correlation between the function definition and the call in main. My program is receiving build errors- please assist with determining what the definition of this program should be. Thank you!

#include <iostream>
using namespace std;


void yrCalc(int totalDays, int& year, int& month, int& day);

      
int main ()
{
  
     int year, month, day, totalDays;

     year = 1900 + totalDays / 365;
     totalDays = year * 365;

     yrCalc(40000, year, month, day);

     cout << year << " - " << month << " - " << day << endl;
	   
  	
return 0;
}
void yrCalc(int totalDays a, int& year b, int& month c, int& day d)
 (
     totalDays = a;
     year = b;
     month = c;
     day = d;
    return;
 }

line 23: you are attempting to give each of the variables two names -- delete a, b, c and d then leave all the rest.

line 23 should look like this: void yrCalc(int totalDays, int& year, int& month, int& day) If you do that then you also have to change lines 25-28 to use the valid variable names shown above.

if you're gonna pass the address of the variables as stated in line 23:
void yrCalc(int totalDays, int& year, int& month, int& day)

Your variables should contain also their address in line 16:
yrCalc(40000, &year, &month, &day);

if you're gonna pass the address of the variables as stated in line 23:
void yrCalc(int totalDays, int& year, int& month, int& day)

Your variables should contain also their address in line 16:
yrCalc(40000, &year, &month, &day);

Not so -- you are thinking C, not C++ because yrCals() does not take pointers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.