首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

这个小程序中有什么有关问题

2012-03-07 
这个小程序中有什么问题//本小程序运行时感觉不对,但又不知问题出在哪。#include iostream#include math

这个小程序中有什么问题
//本小程序运行时感觉不对,但又不知问题出在哪。
#include <iostream>
#include <math.h>
using   namespace   std;
int   main()
{
double   f,x,a;
f=1;
int   k=2;
cin> > x;
a=-x*x/2;
while(fabs(f)> 0.0001)
{
f=a+f;
k=k+2;
a=-a*x*x/k/(k-1);
}
cout < <f < <endl;
return   0;
}


[解决办法]
while里出不来..

热点排行