下面是我实现的三元组:
typedef int NEW_TYPE; typedef struct { NEW_TYPE num1; NEW_TYPE num2; NEW_TYPE num3; }triple; bool InitTriple(triple *p,NEW_TYPE num1,NEW_TYPE num2,NEW_TYPE num3); bool DestroyTriple(triple *p); bool Get(triple *p,int pos,NEW_TYPE *buff); bool Put(triple *p,int pos,NEW_TYPE *buff); bool IsDescending(triple *p); bool IsAscending(triple *p); bool Max(triple *p,NEW_TYPE *pos); bool Min(triple *p,NEW_TYPE *pos);
具体代码在附件中。
时间: 2024-11-10 00:13:06