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> #include<string.h> void main() { char a[201]; while(scanf("%s",a)) { printf("300 420 moveto\n310 420 lineto\n"); int i,m=310,n=420,flag1=0,flag2=1;//flag1=1 meaning last change is n,or m; for(i=0;i<strlen(a);i++) //flag2=1 meaning add; { if(a[i]=='A') { if(flag1==1&&flag2==1) { m=m+10; flag1=0; //if(n>=420&&m>=300) printf("%d %d lineto\n",m,n); continue; } else if(flag1==1&&flag2==0) { m=m-10; flag1=0; // if(n>=420&&m>=300) printf("%d %d lineto\n",m,n); continue; } else if(flag2==0) { n=n+10; flag2=1; flag1=1; //if(n>=420&&m>=300) printf("%d %d lineto\n",m,n); continue; } else if(flag2==1) { n=n-10; flag2=0; flag1=1; //if(n>=420&&m>=300) printf("%d %d lineto\n",m,n); } } if(a[i]=='V') { if(flag1==1&&flag2==1) { m=m-10; flag1=0; flag2=0; //if(m>=300&&n>=420) printf("%d %d lineto\n",m,n); continue; } else if(flag1==1&&flag2==0) { m=m+10; flag1=0; //if(m>=300&&n>=420) printf("%d %d lineto\n",m,n); continue; } else if(flag2==0) { n=n-10; flag1=1; //if(n>=420&&m>=300) printf("%d %d lineto\n",m,n); continue; } else if(flag2==1) { n=n+10; flag1=1; //if(n>=420&&m>=300) printf("%d %d lineto\n",m,n); } } } printf("stroke\nshowpage\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator