void graphDrawArrow (int c1, int l1, int c2, int l2) { int m; graphTest (l1, c1); graphTest (l2, c2); m = (l1 + l2) / 2; while (l1 != m) { graph[l1][c1] = '|'; if (l1 < l2) l1++; else l1--; } while (c1 != c2) { graph[l1][c1] = '-'; if (c1 < c2) c1++; else c1--; } while (l1 != l2) { graph[l1][c1] = '|'; if (l1 < l2) l1++; else l1--; } graph[l1][c1] = '|'; }
//在(c1, l1) (c2,l2)之间绘制一个连线 void graphDrawArrow (int c1, int l1, int c2, int l2) { int m; graphTest (l1, c1); graphTest (l2, c2); m = (l1 + l2) / 2; //中间行:用来绘制直线 while (l1 != m) { graph[l1][c1] = '|'; if (l1 < l2) l1++; else l1--; } //绘制上竖线 while (c1 != c2) { graph[l1][c1] = '-'; if (c1 < c2) c1++; else c1--; } //绘制横线 while (l1 != l2) { graph[l1][c1] = '|'; if (l1 < l2) l1++; else l1--; } //绘制下竖线 graph[l1][c1] = '|'; //最后竖线 }
void graphDrawBox (char *s, int c, int l) { int i; graphTest (l, c+strlen(s)-1+del); for (i = 0; i < strlen (s); i++) { graph[l][c+i+del] = s[i]; } }