Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:你的程序逻辑有点乱

Posted by JohnRayChina at 2010-05-20 14:48:55 on Problem 1004
In Reply To:要算11个月才通过?什么意思? Posted by:spren at 2010-05-18 04:10:38
知道do-while
与while{}的区别以后,

可以这样做
>         int i=0;//注意了,从0开始,那就是从0-11循环12次
>         float tol=0.00;
>         //int tol=0;
>         while( i < 12 )
          {
>                 float in;
>                 scanf("%f", &in);
>                 tol += in;
                  i++;//这儿递增一下
>         }
也可以这样
>         int i=0;//注意了,从0开始,那就是从0-11循环12次,
>         float tol=0.00;
>         //int tol=0;
>         
          do{
>                 float in;
>                 scanf("%f", &in);
>                 tol += in;
                  i++;//这儿递增一下
>         }while( i < 12 )
如果你一定要把用while( i++<... )的形式,先弄清
i++与++i的区别

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator