Objetive

Create a C# program that declares creates a 70x20 two-dimensional array of characters, "draws" a circumference or radius 8 inside it, and displays it on screen.

Hint: the points in the circumference can be obtained using:

x = xCenter + r * cos angle

y = yCenter + r * sin angle

"sin" and "cos" expect the angle to be measured in radians, instead of degrees. To convert from one unit to the other, you must remember that 360 degrees = 2 PI radians (or 180 degrees = PI radians): float radians = (angle * Math.PI / 180.0);

You might draw 72 points (as there are 360 degrees in a circumference, they would be spaced 5 degreees from each other)

Hint: in C#, cosine is Math.Cos, sine is Math.Sin and PI is Math.PI

Solution

Create a C# program that declares creates a 70x20 two-dimensional array of characters, "draws" a circumference or radius 8 inside it, and displays it on screen.

Hint: the points in the circumference can be obtained using:

x = xCenter + r * cos angle

y = yCenter + r * sin angle

"sin" and "cos" expect the angle to be measured in radians, instead of degrees. To convert from one unit to the other, you must remember that 360 degrees = 2 PI radians (or 180 degrees = PI radians): float radians = (angle * Math.PI / 180.0);

You might draw 72 points (as there are 360 degrees in a circumference, they would be spaced 5 degreees from each other)

Hint: in C#, cosine is Math.Cos, sine is Math.Sin and PI is Math.PI

Solution

using System; public class Circumference { public static void Main () { int xCenter=35; int yCenter=10; int r = 8; for(int angle=0; angle<360 data-blogger-escaped-180.0="" data-blogger-escaped-20="" data-blogger-escaped-angle="" data-blogger-escaped-console.setcursorposition="" data-blogger-escaped-console.write="" data-blogger-escaped-double="" data-blogger-escaped-int="" data-blogger-escaped-math.cos="" data-blogger-escaped-math.pi="" data-blogger-escaped-math.sin="" data-blogger-escaped-pre="" data-blogger-escaped-r="" data-blogger-escaped-radians="" data-blogger-escaped-x="" data-blogger-escaped-y="">