2017年9月16日

编写函数fun,计算n!

摘要: #include <stdio.h> double fun ( int n ){ double result = 1.0 ;/************found************/ if (n==0) return 1.0 ; while( n >1 && n < 170 )/******** 阅读全文

posted @ 2017-09-16 17:36 jun俊 阅读(3825) 评论(0) 推荐(0)

编写函数fun,将一个数字字符串转换为一个整数,例如,输入字符串"-1234",则函数把他转换为整数值-1234

摘要: #include #include long fun ( char *p) { int len,t; long x=0; len=strlen(p); if(p[0]=='-') {t=-1;len--;p++;} else t=1; while(*p) x=10*x+(*p-48),p++; return x*t; } main() /* 主函数 */ { char s[6]... 阅读全文

posted @ 2017-09-16 15:42 jun俊 阅读(11809) 评论(0) 推荐(0)

导航