Difference in days between two dates
@Snowbody has addressed many important points.  I'll just talk about the std::map.

The function initializes daysInMonth each time, which is just unnecessary.  You should have it initialized only once elsewhere, and it should also be const since it's not to be modified within the code.

If you have C++11 (which you should), you can initialize the map with an initializer list:

const std::map&lt;int, int&gt; daysInMonth = { {1, 31},
                                         {2, 28},
                                         {3, 31},
                                         {4, 30},
                                         {5, 31},
                                         {6, 30},
                                         {7, 31},
                                         {8, 31},
                                         {9, 30},
                                         {10, 31},
                                         {11, 30},
                                         {12, 31} };


(it can be formatted in any way you'd like)

You should also use an unsigned type for dates since they cannot be negative.