I've written this code but it is not giving the Exact (Precise) answer. It automatically rounds up the answer. Please take a look at this and help me solve this issue. When I calculate with calculator it shows me different results and when I calculate with my program it show me different results which I think are not Exact, I want exact results. The value I am using for rad1 = 281.531 and rad2 = 118.213. See the attached image. Note: This is the first time I am asking a question online, so please ignore my mistakes.
#include <iostream>
using namespace std;
double circleArea (double);
int main()
{
double rad1,rad2;
double ringarea;
cout << "Please enter the radius of Outer Circle: ";
cin >> rad1;
cout << "Please enter the radius of Inner Circle: ";
cin >> rad2;
ringarea = circleArea(rad1) - circleArea(rad2);
cout << "The area of the Outer Circle is: " << circleArea(rad1) << endl;
cout << "The area of the Inner Circle is: " << circleArea(rad2) << endl;
cout << "The area of the Ring is: " << ringarea << endl;
return 0;
}
double circleArea (double r)
{
double pi = 3.1415926;
return (pi * r * r);
}