| ||||||||||
| 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 | |||||||||
Re:请教一下In Reply To:请教一下 Posted by:guangdianytm at 2015-03-17 12:57:54 > 用C编怎么判断结束?
> if(EOF==scanf(%d,&pairs))
> break;
> 貌似不行啊
> #include<stdio.h>
> int main()
> {
> double xpos[1000],ypos[1000];
> int i;
> int pairs;
> while(1)
> {
> scanf("%d",&pairs);
> if(EOF==pairs)
> break;
> for(i=0;i<pairs;i++)
> {
> scanf("%lf",&xpos[i]);
> scanf("%lf",&ypos[i]);
> }
> printf("%d ",pairs);
> for(i=0;i<pairs-1;i++)
> printf("%.6f %.6f ",(xpos[i]+xpos[i+1])/2,(ypos[i]+ypos[i+1])/2);
> printf("%.6f %.6f\n",(xpos[i]+xpos[0])/2,(ypos[i]+ypos[0])/2);
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator