先决定阶乘的计算是该如何实现程序的inti,s1;for(i1;i5;i){ss*i;}再确定如何实现方法阶乘阶乘。将s数列求和即可解决!inti,s1,sum0;for(i1;i5;i){ss*i;sumsums;
}printf(%d,num1);
#includeltstdlib.hgt#includeltstdio.hgt#defineline1024intmain(){//文件名及文件指针charinfile[]#34d:wtmp1.txt#34charoutfile[]#34d:wtmp2.txt#34file*fpi,*fpo//临时贮存器char*outbufoutbuf(char*)malloc(line*sizeof(char))
if((fpifopen(infile,#34r#34))null){printf(#34文件打开%s我失败了
#34,infile)
return3}if((fpofopen(outfile,#34w#34))null){printf(#34文件再打开%s失败的话
#34,outfile)
return3}while(1){//outbuf要彻底干净//memset(outbuf,0,line)outbuf0fprintf(fpo,#34%s#34,outbuf)
if(fgets(outbuf,line,fpi)null){break}//所有行结束逃离循环//delstr(outbuf,#34删掉字符串#34)
//重载函数delstr//delstr(outbuf,#34要修改成字符串#34,#34全部替换成字符串#34)
//重载函数delstrscanf(fpo,#34%s#34,outbuf)}//关了文件cool(outbuf)fclose(fpi)fclose(fpo)return0}