| ||||||||||
| 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 | |||||||||
错的很诡异啊,什么原因啊?
我把数据从小到大输入都正确,但是当我在一个小的数据之前有一个大的数据时,就会出错,好象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;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator