Don't know how to approach this problem, here's what I have so far, any help would be greatly appreciated.
PROBLEM : Modify the function days() written for exercise 1 to account for the actual number of days in each month. Assume each year contains 365 days( that is do not account for leap years).
#include <iostream>
#include <string>
using namespace std;
struct Date
{
int month;
int day;
int year;
};
int days(Date*);
int main()
{
const Date date_init = {0,0,0};
Date* dt1 = new Date();
*dt1 = date_init;
cout << " Please input the days" ;
cin >> dt1->day;
cout << " Please input the months" ;
cin >> dt1->month;
cout << " Please input the year" ;
cin >> dt1->year;
days(dt1); // function that takes a structure variable as argument.";
cout << days(dt1);
delete dt1;
return 0;
}
int days(Date *d1)
{
int convdays;
int basis;
convdays = (d1->day) - 1 + 30*((d1->month) -1) + 365*((d1->year) -1900);
return convdays;
}