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:chengning at 2006-07-22 02:38:07 > > 我把数据从小到大输入都正确,但是当我在一个小的数据之前有一个大的数据时,就会出错,好象i 就是个静态的一样,哪位大侠看看. > > > #include<iostream.h> > int main() > { > int i=0; > float m,sum=0; > cin>>m; > while(m!=0.00) > { > if(m<=5.20&&m>=0.01) > { > while(sum<=m) > { > i++; > sum+=(float)1/(i+1); > } > cout<<i<<" card(s)"<<endl; > } > cin>>m; > } > return 0; > } sum没初始化(多TEST CASE) 以后要注意INITIATION Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator