Question: fix function: void draw _ equilateral ( char art [ DIM ] [ DIM ] , int side, int x , int y ) {

fix function:
void draw_equilateral(char art[DIM][DIM], int side, int x, int y){
int height = static_cast(round((sqrt(3)/2)* side));
for (int row =0; row < height; ++row){
int row_half_width = static_cast(round((static_cast(row)/ hei\
ght)*(side /2)));
int left_bound = x - row_half_width;
int right_bound = x + row_half_width;
for (int col = left_bound; col <= right_bound; ++col){
if (y + row < DIM && col >=0 && col < DIM){
art[y + row][col]= FILL;
}
}
}
}
considering;
const int DIM =64; const char FILL ='@'; const char EMPTY ='';

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 Programming Questions!