Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
牛人们,帮忙看个程序吧...#include<stdio.h> void main() { char str[200]; int i,m=310,n=420,x,y; while(scanf("%s",str)!=EOF) { printf("300 420 moveto\n"); printf("310 420 lineto\n"); m=310;n=420; for(i=0;str[i];i++) { if(str[i]=='V') { if((m+n)%20==0) { if(n>420) { x=m-10;y=n; printf("%d %d lineto\n",x,n); } if(n<420) { x=m+10;y=n; printf("%d %d lineto\n",x,n); } } if((m+n)%20!=0) { y=n+10;x=m; printf("%d %d lineto\n",m,y); } m=x;n=y; } if(str[i]=='A') { if((m+n)%20==0) { if(n>420) { x=m+10;y=n; printf("%d %d lineto\n",x,n); } if(n<420) { x=m-10;y=n; printf("%d %d lineto\n",x,n); } } if((m+n)%20!=0) { y=n-10;x=m; printf("%d %d lineto\n",m,y); } m=x;n=y; } } printf("stroke\n"); printf("showpage\n"); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator