Help please!

I don't understand why isn't this program working!!!???

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  #include<iostream>
#include<string>
using namespace std;


struct date
{
	int month;
	int day;
	int year;
};

int days(date);

main()
{
	date dt = { 1, 26, 2015 };

	
	cout << "The number of days passed after 1900 is: " << days(dt)<<endl;
	
	system("pause");
	return 0;
}

int days(date temp)
{
	return ((temp.day - 1) + 30 * (temp.month - 1) + 360 * (temp.year - 1900));
}
return type for main(). It should be int
are you sure that:
((temp.day - 1) + 30 * (temp.month - 1) + 360 * (temp.year - 1900));
is anywhere near the correct calculation?

for a gross calculation:
1
2
3
4
int days(date temp) {
	int Days = (temp.year-1900)*365 + (temp.month-1)*30 + (temp.day);
	return Days;
}


now you can add leap year counter in that for exact answer.


but, i think there are library facilities for that.
Thanks guys!!!
It works now. I didn't realize that return type of main is missing!
Topic archived. No new replies allowed.