摘要: 标准输出函数cout :/*关于浮点数的格式*/#include <iostream.h>void main(){ float f=2.0/3.0,f1=0.000000001,f2=-9.9; cout<<f<<' '<<f1<<' '<<f2<<endl; //正常输出 cout.setf(ios::showpos); //强制在正数前加+号 cout<<f<<' '<<f1<<' '<&l 阅读全文
posted @ 2011-03-20 22:43 SunnyDay2015 阅读(17603) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <iomanip>#include <cassert>using namespace std;int factorial(int i){ if(i==0 || i==1) { return 1; } else { int product = 1; for(int j=1; j<=i; j++) { product = product*j; } return product; }}int main(){ long double sum = 0; cout << "n e&quo 阅读全文
posted @ 2011-03-20 22:36 SunnyDay2015 阅读(306) 评论(0) 推荐(0) 编辑