| ||||||||||
| 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:306565318 at 2008-10-14 21:01:26 > #include<iostream>
> #include<iomanip>
> using namespace std;
> void main()
> {
> cin>>setprecision(3);
> float number;
> while(cin>>fixed>>number)
> {
> float sum=0;
> if(number<0.01||number>5.20)
> {
> cout<<"input error"<<endl;
> cin>>fixed>>number;
> }
> if(number==0)
> return;
> for(float i=2;sum<number;i++)
> {
> sum+=(1/i);
> }
> cout<<i-2<<" card(s)"<<endl;
> }
>
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator