📄 pi.cpp
字号:
#include <iostream>
#include <iomanip>
using namespace std;
/*main information*/
void info()
{
cout << "pi/ 4 ~= 1 - 1/3 + 1/5 - 1/7 + ......";
cout << endl << endl;
}
/*source code*/
void test()
{
//input code here......
double i, p = -1, t = 0;
for (i = 1; 1 / i > 10e-8; i+=2)
{
p = -p;
t += p / i;
}
cout << "pi = " << setprecision(8) << t * 4;
}
/*information of source code owner*/
void end()
{
cout << "\n\n\n______________\n";
cout << "xiao zhiqiang\n";
cout << "inxk@163.com\n";
cout << "Sep,2006";
getchar();
}
/*the main code*/
void main()
{
info();
test();
end();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -