好的,所以,我制作了一个计算在2个日期之间的程序。 (First_date已经给出,第二个我们应该自己做这个日/月/年)之后我想让程序计数我们的second_date并告诉这个日期是否已经/是/或将
time_t t = time(0);
struct tm * now = localtime( & t );
if (second_day < now->tm_mday + 1900)
{
if (second_month < now->tm_mon +1)
{
if (second_year < now->tm_year)
{
cout << "We had: ";
}
}
}
else if (second_day = now->tm_mday + 1900)
{
if (second_month = now->tm_mon +1)
{
if (second_year = now->tm_year)
{
cout << "Hey, you just entered our current date!" << endl;
cout << endl;
cout << "Right now we have: ";
}
}
}
else if (second_day > now->tm_mday + 1900)
{
if (second_month > now->tm_mon +1)
{
if (second_year > now->tm_year)
{
cout << "We will have: ";
}
}
}
else
{
cout << endl;
}
问题是他只是跳过这一部分。 使它运作的最佳方法是什么?