📄 plottour.c
字号:
/* * plotTour.c * * Phil Cox, B00XXXXXX * Login: pcox * CSCI2132: Assignment 3 * */#include <stdio.h>#include "list.h"void plotTour(struct node *tour){ /* * Print postscript code depicting a given tour */ struct node *curr; if (tour == NULL) return; printf("%%!\n50 50 translate\n0 0 512 512 rectstroke\n"); /* plot the tour's edges */ printf("%5.1f %5.1f moveto\n", 512.0*tour->x, 512.0*tour->y); printf("1.0 0.0 0.0 setrgbcolor\n"); for (curr=tour->next; curr != NULL; curr=curr->next) printf("%5.1f %5.1f lineto\n", 512.0*curr->x, 512.0*curr->y); printf("closepath stroke\n"); /* plot dots marking the locations of the nodes */ printf("0.0 0.0 0.0 setrgbcolor\n"); for (curr=tour; curr!=NULL; curr = curr->next) { printf("newpath\n"); printf("%5.1f %5.1f 2 0 360 arc\n", 512.0*curr->x, 512.0*curr->y); printf("closepath\nfill\n"); } printf("showpage\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -