怎样运用QT的计算宝贝女生年龄
2010-12-08 05:24:00 来源:WEB开发网核心提示:1 QDate birthday(2010,10,13);2 QDate today;3 today = QDate::currentDate ();4 int daysold = birthday.daysTo (today);5 ui->lcdNumber_2->display (daysol
1
QDate birthday(2010,10,13);
2 QDate today;
3 today = QDate::currentDate ();
4 int daysold = birthday.daysTo (today);
5 ui->lcdNumber_2->display (daysold);
2 QDate today;
3 today = QDate::currentDate ();
4 int daysold = birthday.daysTo (today);
5 ui->lcdNumber_2->display (daysold);
说明:
int QDate::daysTo ( const QDate & d ) const
Returns the number of days from this date to d (which is negative if d is earlier than this date).
QDate d1(1995, 5, 17); // May 17, 1995 QDate d2(1995, 5, 20); // May 20, 1995 d1.daysTo(d2); // returns 3 d2.daysTo(d1); // returns -3
更多精彩
赞助商链接