I'm trying to write a program that can find like the first million digits of pi, and I'm having some trouble finding a variable that can hold that many digits. Im still pretty new with c++ so yeah....
Thank You in advance! :D
Edit:
I already tried int(derr lol) and floats, but floats only hold 5 digits T_T
jsmith is right, but I was trying to come up with another solution. Assuming 22/7 was actually a good representation of PI and you were happy with 9999999 digits of precision this would work:
BTW, you may want to use sleep or something so you can actually see the results.
#include<iostream>
usingnamespace std;
int main(){
int x[99999];cout<<"here";
int dividend=22;
int divisor=7;
int remainder=1;
int count=0;
while(remainder!=0&&count<9999999)
{
x[count]=dividend/divisor;
remainder=dividend%divisor;
remainder=remainder*10;
dividend=remainder;
cout<<x[count];
if(count==0) cout<<".";
++count;
}
return 0;
}