Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / C++

Calculate pi to one million decimal places

Rate me:
Please Sign up or sign in to vote.
4.74/5 (40 votes)
19 Sep 20053 min read 296.5K   4.2K   38  
A simple program that should take a few hours to run.
// CRHCalculatePiClass.h: interface for the CRHCalculatePiClass class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CRHCALCULATEPICLASS_H__C278968F_10B2_4096_BF1D_C70D071C4EF7__INCLUDED_)
#define AFX_CRHCALCULATEPICLASS_H__C278968F_10B2_4096_BF1D_C70D071C4EF7__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CRHCalculatePiClass  
{
public:
	//CRHCalculatePiClass();
	//virtual ~CRHCalculatePiClass();

// vvv CRH

private:
	static void dispresult(void);
	static void do239term(void);
	static void do5term(void);
        static void calculate();
        static void init();

public:
	static void CRHCalculatePi();

// ^^^ CRH
};

#endif // !defined(AFX_CRHCALCULATEPICLASS_H__C278968F_10B2_4096_BF1D_C70D071C4EF7__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Retired
United Kingdom United Kingdom
I've been programming computers since about 1968. I started at school with Algol 60 on an Elliott 803. From there I progressed through the Z80 and other microprocessors to the PC, DOS and Windows, Pascal, C and C++.

My other interests include astronomy and classical music. All of my contributions to Code Project have arisen from programs I've written in these areas.

Comments and Discussions