Eh, all you have to change is
cout << fixed << total;
Oh, haha, can't believe it was that easy! But why don't you just use the fixed commmand for everything instead of using the libraries? Is there a limit?
Yes, double is usually 64 bits wide. That's enough for up to 16 significant digits, but no more. You can't do any sort of precise calculations with floating point numbers.