Question: #include #include #include #define matrix_size 100 //draw rectangle (x1,y1) length L wedth W void rect (int x1, int y1,int L,int W, char arr[matrix_size][matrix_size]); //draw line

#include

#include

#include

#define matrix_size 100

//draw rectangle (x1,y1) length L wedth W

void rect (int x1, int y1,int L,int W, char arr[matrix_size][matrix_size]);

//draw line (x1,y1) to (x2,y2)

void line (int x1, int y1, int x2,int y2, char arr[matrix_size][matrix_size]); //draw circle center( a,b ) and radius=r void circle (int a, int b,int r, char arr[matrix_size][matrix_size]); //drow Vertical line at x=x1 (x1,y1) to (x1,y2) void vertical_Line (int x1, int y1, int y2, char arr[matrix_size][matrix_size]); int main()

{

char arr[matrix_size][matrix_size]; for(int y = 0; y

arr[y][x] = ' '; //fill the matrix with - //draw rectangle (63,60) length 30 wedth 10

rect (63, 60,30,10,arr);

//draw line (3,3) to (33,13)

line(3,3,33,13,arr);

//draw vertical Line at x=80

vertical_Line(80,13,23,arr);

//draw circle center( 60,20) radius=10

circle(60,20,10,arr); //plot the matrix for(int y = 0; y

for (int x = 0; x

printf("%c", arr[y][x]);

printf(" ");

//draw rectangle (x1,y1) length L wedth W void rect (int x1, int y1,int L,int W, char arr[matrix_size][matrix_size]) {

for(int y = 0; y

{ for(int x = 0; x

// see if we're within the range of x and y

if(x > x1 && x y1 && y

//draw circle center( a,b ) and radius=r

void circle (int a, int b,int r, char arr[matrix_size][matrix_size])

double EPSILON = 6;// need to be close to the radius value for(int y = 0; y

// see if we're close to (x-a)**2 + (y-b)**2 == r**2 if( fabs(pow((x-a),2)+pow((y-b),2)-pow(r,2))

//draw line (x1,y1) to (x2,y2)

void line (int x1, int y1, int x2,int y2, char arr[matrix_size][matrix_size]) {

//0=y-m*x-c double EPSILON = 0.5, m, c; m= (double) (y2-y1)/(x2-x1); // the slope of the line c=m*x1-y1;

//the y-intercept of the line

for(int y = 0; y

for(int x = 0; x

// see if we're close to y = m*x + c

if( x >= x1 && x

void vertical_Line (int x1, int y1, int y2, char arr[matrix_size][matrix_size])

for(int y = 0; y

for(int x = 0; x y1)

arr[y][x] = '*';

A. Consider the C code named 'Shapes_Online C compiler'. Modify this code so it produces the given shape using the cartesian coordinates you chose in part 'A'.

#include#include#include#define matrix_size 100//draw rectangle (x1,y1) length L wedth Wvoid rect (int x1,

\f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!