payroll.cpp

来自「数据结构与算法分析」· C++ 代码 · 共 36 行

CPP
36
字号
#include <iostream.h>
#include <stdlib.h>
#include <string.h>

#include "book.h"

class Payroll {
public:
  int ID;
  char* name;
};

class IDCompare {
public:
  static bool lt(Payroll& x, Payroll& y)
    { return x.ID < y.ID; }
  static bool eq(Payroll& x, Payroll& y)
    { return x.ID == y.ID; }
  static bool gt(Payroll& x, Payroll& y)
    { return x.ID > y.ID; }
};

class NameCompare {
public:
  static bool lt(Payroll& x, Payroll& y)
    { return strcmp(x.name, y.name) < 0; }
  static bool eq(Payroll& x, Payroll& y)
    { return strcmp(x.name, y.name) == 0; }
  static bool gt(Payroll& x, Payroll& y)
    { return strcmp(x.name, y.name) > 0; }
};

int main(int argc, char** argv) {
  Payroll* foo;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?