Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Got Part A, so just answer Part B. Need it as soon as possbile. 3.) The grid_t t

ID: 3570693 • Letter: G

Question

Got Part A, so just answer Part B. Need it as soon as possbile.

3.) The grid_t type below can be used to store a width by height grid of altitudes. Adjacent grid points on the x (first) axis are separated by dx meters. Similarly, adjacent grid points on the y axis (second) are separated by dy meters. typedef struct { double dx, dy; double alt[MAX] [MAX]; int width, height; } grid_t; Write a function that creates a new grid_t struct and returns a pointer to it. Its parameters should include the data needed to initialize the values of the structure. It should also zero out the altitudes before returning. Write a function that takes a grid t and modifies what it is passed to return the x,y coordinate of the highest point in the grid. ( 15) {Return the distance the point is from the upper left comer.}

Explanation / Answer

typedef struct
{
   double dx,dy;
   double alt[MAX][MAX];
   int width,height;
}grid_t;

double func(grid_t g){
   int i,j,maxi,maxj;
   double max=g->alt[0][0];
   for(i=0;i<w;i++)
      for(j=0;j<h;j++){
          if(g->alt[i][j]>max)
              max=g->alt[i][j];
              maxi=i;
              maxj=j;
      }
     
return sqrt((0-i)*(0-i)+(j-h+1)*(j-h-1));


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote