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:要算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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator