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:peanutgyz at 2004-03-18 18:42:52 > #include <iostream> > #include <iomanip> > using namespace std; > int main() > { > int n; > > > bool b=false; > while(cin>>n) > { > if(b==false) > { > cout<<"Cards Overhang "<<endl; > b=true; > } > float f=0; --------------------------------->double > for(int i=1;i<n||i==n;i++) > { > f+=1.0/(2*(i)); > } > if(n<4) > cout<<setw(5)<<n<<" "<<setw(8)<<showpoint<<std::setprecision(3)<<f<<endl; > else > cout<<setw(5)<<n<<" "<<setw(8)<<showpoint<<std::setprecision(4)<<f<<endl; > > } > return 0; > } > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator