Rounding Irrational Numbers

As a test of my knowledge, I'm making a program to write out the digits of Pi one by one, using algorithms. I have the algorithm I created, but I don't think I need to add it. As long as you can help me with this:

In order for my algorithm to work, I need to round off an irrational number to the nearest 10'th. I was able to figure out how to do this with rational numbers, like '3.14'. But, I need to do it with an irrational number, for example √3.

Actually, I could probably figure out how to do this myself if I knew how to out put them; Using Dev C++, I don't think it's possible to do
cout << √3
(I know that's not how to represent an irrational number in C++, but it's just an example.) But I believe it would just output '2'.

Any ideas on how I could round an irrational number? Tell me if you need my code.
closed account (Dy7SLyTq)
floats with setw()
Topic archived. No new replies allowed.