const short* pi = ExtendPi(decimal_places);
cout <<" "<< pi[0] <<'.';
for(int i=1;i<decimal_places;i++)
cout << pi[i];
/*
function that take decimal places (10,20,30,~)
for calculating Pi extended into power
programmed by: khaled khunaifer [Plus]
*/
short* AdvancedPi(int PLACES=50){
short Pi[PLACES]={3,1,4,0} // 50 places of Pi
long double P = ((22*(10^10))/7); // maximize the arithmetic
long int I= Pi; // integer part
long double D = (Pi - I); // decimal part
for(int j=0;j<PLACES/10;j++){
for(int i=0;i<10;i++){
Pi[9-i] = I%10;
I /= 10;
} // I is 0 now
D *= (10^10);
I = D;
D -=I;
}
return Pi;
}

New Topic/Question
Reply



MultiQuote



|