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 |
牛人们帮帮忙啊,就是过不了,郁闷啊~~急救!!!wrong#include <iostream> #include <iomanip> using namespace std; int i; double a[10],s[10]; int jie(int n) { int sum=1; for(int i1=1;i1<=n;i1++) { sum=sum*i1; } return sum; } double add(double p[],int n) { double sum; for(int i2=0;i2<=n;i2++) sum+=p[i2]; return sum; } void main() { a[0]=1; for(i=1;i<10;i++) { a[i]=(double)1/jie(i); } cout<<"n e"<<endl; cout<<"- -----------"<<endl; for(i=0;i<10;i++) { s[i]=add(a,i); } for(i=0;i<3;i++) { cout<<i<<" "<<s[i]<<endl; } for(i=3;i<10;i++) { cout<<i<<" "<<setiosflags(ios::fixed)<<setprecision(9)<<s[i]<<endl; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator