### Precision problem

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475`` ``````#include using namespace std; int main() { cout.precision(50); cout<<"Anmol's Square Root Calculator!"<> num; cout<<""<> num; cout<<""<> playAgain; cout <<" "<> playAgain; cout <<" "<

Well I am 12 and my name is Anmol. For my math class we are learning about square roots. According to my teacher its only possible to find the square root using a calculator or a table which is pretty obviously false as the calcuator needs a method to compute the sqrt. After extensive research I made this code using the Babylonian algorithm. But im facing a problem
In this code I specifically set the precision of the decimals to 15. However it outputs numbers at 12 decimals. But in this code it outputs at 15 decimals.

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182`` ``````#include using namespace std; int main() { cout.precision(18); cout<<"Anmol's Square Root Calculator!"<> num; cout<<""<> num; cout<<""< 0) { x = guess =(guess + (num/guess))/2; cout<<""<> playAgain; cout <<" "<> playAgain; cout <<" "<

Im very confused on why this is happening. I tried cout << fixed << showpoint; but it looks unpleasant when the num outputs 15 zeros for no reason. Can anyone enlighten me on why this is happening and how to fix it? In a book I read its more efficient to use a for loops for algorithms so I wanna use the for instead of the while loop. Also I have a second question. Why cant I go over the 15 decimals? If I set the precision to 30/40 it does nothing to my output even though in my computer calculator it goes to 30/40. Is there another integer type I should use instead of double?

Sorry if any of it looks like a big wall of text xD.

Im in a rush to type this cause its 12:05am for me atm.