比较简陋的数据库应用,唯一能看的就是对ODBC的封装...
源代码在线查看: time.cpp
#include
#include "Time.h"
Time::Time(String str)
{
int i,j;
char *buffer = new char[str.getlenth() + 1];
for (i = 0; i < str.getlenth() + 1; i++)
buffer[i] = str.getChar(i);
j = 4;
while (i >= 0)
{
if (buffer[i] == '.')
{
time[j] = atoi(buffer + i + 1);
j--;
buffer[i] = '\0';
}
i--;
}
time[j--] = atoi(buffer);
while (j >= 0)
{
time[j] = 0;
j--;
}
delete [] buffer;
}
Time::~Time()
{
}
int Time::GetTime(int i)
{
if (i >= 0 && i < 5)
return time[i];
else
return -1;
}
bool Time::operator==(const Time& t) const
{
int i = 0;
bool flag = true;
while (i < 5 && time[i] == t.time[i])
{
i++;
}
if (i < 5)
flag = false;
return flag;
}