#include <stdio.h>#include <stdlib.h>int sum(int n){ int k=0; if(n==1)return 1; k=n+sum(n-1); return k;}void main(int argc,char *argv[]){ int n; FILE *fp; if(argc!=2) { printf("\nToo few parameter"); exit(0); } printf("\nEnter a integer number:(>0)"); scanf("%d",&n); fp=fopen(argv[1],"w"); printf("sum(n)=%d",sum(n)); fprintf(fp,"sum(n)=%d",sum(n)); fclose(fp);}
别人都在假装不YD,那我就只有假装YD啦! 欢迎加入 YD一族,让我们一起创造属于我们的奇迹! 具体详情请垂询我们的业务部经理:我的电脑。
引用第9楼wzs于2008-03-20 21:11发表的 :没啥问题啊楼主想问啥问题啊
if(argc!=2){ printf("\nToo few parameter"); exit(0);}