int sum = 0; // sum
int w = 0; // width
int r = 0; // radius
int y = 0; // height
int n = 0;
int a = 0; //area
double pow = 0; // power
double sqr = 0;
cout << "Circle Radius: \n";
cin >> r;
cout << "Exact Area: \n";
cin >> a;
cout << "Area with 100 rectangles: \n";
cout << "Difference from the exact area: ";
cout << "Approximate using 1000 rectangles: \n";
cout << "Difference from the exact area: ";
cout << "Approximate using 10000 rectangles: \n";
cout << "Difference from the exact area: ";
cout << "Approximate using 100000 rectangles: \n";
cout << "Difference from the exact area: ";
w * sqr(pow(r - w)); //area of the first rectangle
w * sqr (pow(r - 2 * w));//area of the second rectangle
w * sqr (pow(r - 3 * w));//area of the third rectangle
So pow is a double, and sqr is a double. They're just two numbers. What exactly do you intend by saying w * sqr(pow(r - w));
given that sqr and pow are just two numbers? What's supposed to happen there?
repeat: What's that meant to do? start: Likeiwise.
^ That means XOR, as in the Exclusive-Or operator. Is that what you meant?
I think you need to go back and restart on C++ syntax.
The program must allow the user to investigate an indefinite number of circles without having to restart each time. How do I use the loop in main()??
The user also needs to be prompted to enter a radius.
The program needs to approximate the area of a circle using the method called running sum technique.
Im tring to use the pow() function to computer the square of the value instead of multiplying the valueby itself.
There needs to be 5 calculations.
1. The exact area, using 3.141592653598979 (use all digits for accuracy)
2. Approx area using 100 rectangles
3. Approx area using 1000 rectangles
4. Approx area using 10000 rectangles
5. Approx area using 100000 rectangles