iloveyouf1987 的 站内主页
2008
07-31
07-31
利用公式 圆周率=1-1/3+1/5-1/7+....来求圆周率的近似值,直到最后一项的绝对值小于0.00001为止。我自己编的程序如下:
#include"stdio.h"#include"math.h"void main(){int i=j=1;
float x,y=0;while(fabs(x)<pow(10,-5)) {x=4*(pow(-1,j+1)*(1....
Read More >
2008
07-27
07-27
getchar函数只能用一次吗?#include<stdio.h>void main(){int a,b;a=5;b=4;if(getchar()=='+') printf("%d+%d=%d",a,b,a+b);else if(getchar()=='-') printf("%d-%d=%d",a,b,a-b);else printf("input e....
Read More >