#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);}
引用第9楼wzs于2008-03-20 21:11发表的 :没啥问题啊楼主想问啥问题啊
if(argc!=2){ printf("\nToo few parameter"); exit(0);}