13.输入一个数,求1! + 3! - 5! + 7! - 9! ……(2*n+1)!
#include<iostream> using namespace std; int JiShuJieCheng(int); int main() { int n; int sum=0; cout<<"please input an number : "<<endl; cin>>n; for(int j=1;j<=n;j++,j++) { sum+=JiShuJieCheng(j); } cout<<sum<<endl; return 0; } int JiShuJieCheng(int p) { int m=1; for(int i=1;i<=p;i++) { m*=i; } return m; }