compare.c
来自「一个用C编写的简单的关系数据库系统」· C语言 代码 · 共 32 行
C
32 行
int Compare(RecUnion * x, RecUnion * y, int typeX, int typeY)
{
if (typeX != typeY)
{
puts(" 输入条件错误,类型不符,不能进行比较");
return ERROR;
}
switch (typeX) {
case Int:
if (x->intType - y->intType == 0)
return EQ;
else if (x->intType - y->intType > 0)
return GT;
else
return LT;
case Float:
if ((x->floatType - y->floatType <= 0.00001) && (x->floatType - y->floatType >= -0.00001))
return EQ;
else if (x->floatType - y->floatType > 0.00001)
return GT;
else
return LT;
case String:
if (strcmpi(x->string, y->string) == 0)
return EQ;
else if (strcmpi(x->string, y->string) > 0)
return GT;
else
return LT;
}
return ERROR;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?