triple.c

来自「压缩包里面的都是精致的基本C语言小程序」· C语言 代码 · 共 62 行

C
62
字号
#include "mystdlib.h"#include "commonInter.h"#include "triple.h"struct triple{  poly x;  poly y;  poly z;};triple newTriple (poly x, poly y, poly z){  triple temp = checkedMalloc (sizeof (*temp));  temp->x = x;  temp->y = y;  temp->z = z;  return temp;}poly tripleFirst (triple t){  return t->x;}poly tripleSecond (triple t){  return t->y;}poly tripleThird (triple t){  return t->z;}str tripleToString (triple t){  str sx = getVft (t->x)->toString (t->x);  str sy = getVft (t->y)->toString (t->y);  str sz = getVft (t->z)->toString (t->z);    str s1 = strConcat (newStr ("("), sx);  str s2 = strConcat (s1, newStr (", "));  str s3 = strConcat (s2, sy);  str s4 = strConcat (s3, newStr (", "));  str s5 = strConcat (s4, sz);  str s6 = strConcat (s5, newStr (")"));  strFree (sx);  strFree (sy);  strFree (sz);  strFree (s1);  strFree (s2);  strFree (s3);  strFree (s4);  strFree (s5);  return s6;}

⌨️ 快捷键说明

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