Question: You need to create a Circle class that draws a circle on the screen as location x/y. The code to create the circle is provided
You need to create a Circle class that draws a circle on the screen as location x/y. The code to create the circle is provided in Helpful Resources. Your class needs to read input from a file, the file contains may rows, each row represents the attributes of a circle. The first two values is the X/Y location of the center point of the circle. The next value is the radius, the forth value is the color of the circle. So the input
10 10 15 14
means create a circle that has its center at point 10,10, the radius is 15 and the color is 14 (yellow).
An example of input file would be:
10 10 15 14
50 20 5 15
The output would be as follows:
USING THIS CODE TO DRAW A CIRCLE:
#include #include using namespace std; int main() { float n, j, i, p; cout << "enter n "; cin >> n; n = n + 3; p = floor((4 * n - 2.5) / 5.8); for (j = p; j >= -p; j--) { for (i = -n; i <= n; i++) { if (p * p * i * i + n * n * j * j <= n * n * p * p) cout << "*"; else { cout << " "; } } cout << endl; } return 0; } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
