I have a code that calculates the number of days between dates. It considers leap years and different days among months. The problem I have is when i debug the code nothing comes out.

Here is the code.

#include<iostream>

#include<fstream>

using namespace std;

bool wheep();

int daysinmonth();

bool wheep(int yr)

{

if (yr % 400 == 0)

return true;

else if (yr % 4 == 0 && yr % 100 != 0)

return true;

else

return false;

}

int daysinmonth(int m, int y)

{

switch (m)

{

case 1:

return 31;

case 3:

return 31;

case 5:

return 31;

case 7:

return 31;

case 8:

return 31;

case 10:

return 31;

case 12:

return 31;

case 4:

return 30;

case 6:

return 30;

case 9:

return 30;

case 11:

return 30;

case 2:

{

if (wheep(y))

return 29;

else

return 28;

}

default:

cout << "error";

}

}

int main()

{

int m1, d1, y1, m2, d2, y2, total;

ifstream fin("dates.txt");

fin >> m1 >> d1 >> y1 >> m2 >> d2 >> y2;

if (m1 == m2 && y1 == y2)

total = d2 - d1 + 1;

else

{

total = daysinmonth(m1,y1) - d1 + 1;

for (int i = m1 + 1; i < m2; ++i)

total += daysinmonth(i, y1);

total += d2;

}

while (!fin.eof())

{

cout << m1 <<" "<< d1 <<" "<< y1 <<" "<< m2 <<" "<< d2 <<" "<< y2 <<" "<<total<<endl;

fin >> m1 >> d1 >> y1 >> m2 >> d2 >> y2;

}

fin.close();

system("pause");

return 0;

}

this is the file its reading

1 7 9 1 10 9