程序代码:
#include <iostream> using namespace std; int main( void ) { double e = 0; for( unsigned i=0,f=1; f<1000000; f*=++i ) e += 1.0/f; cout << "e = " << e << endl; }
#include <iostream> using namespace std; int main( void ) { double e = 0; for( unsigned i=0,f=1; f<1000000; f*=++i ) e += 1.0/f; cout << "e = " << e << endl; }