程序代码: #include <iostream>using namespace std;class CTime//时间类{private:unsigned short int hour; //时unsigned short int minute; //分unsigned short int second; //秒public:CTime(int h=0,int m=0,int
最近在从mysql数据库取数据,显示到界面上时,发现第三列明显比前面2列显示要靠上(不在同一水平线上)。 想到应该是在向数据库插入数据时使用的是ctime()函数,记得这个函数返回的const char *末尾有一个\n(换行符)。man手册给出ctime()说明: It converts the calendar time t into a null-terminated string