Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(b) (15 points) Given a Cartesian coordinate value (a, b), write a function that sum up all values from (0,0) to (a, b) inclusive, by

image text in transcribed

(b) (15 points) Given a Cartesian coordinate value (a, b), write a function that sum up all values from (0,0) to (a, b) inclusive, by traveling along the x-axis first, and then the y-axis. The header of the function should look like int sum_vals (point_t*** my-grid, int rows, int cols, int a, int b); rows and cols are the size of the grid, as before. (15 minutes) For example, given the following 3x3 grid from before and if you call the function (0,2,7) (1,2,9) (2,2,3) (0,1,8) (1,1,0) (1,1,0)|(2,1,2) (0,0,4) (1,0,8)|(2,0,3) as follows: int sum = sum vals(my-grid, rows, cols, 1, 2); then the value in sum should be 21: Starting from (0, 0, 4), you pass through (1, 0, 8), (1, 1, 0), ending up at (1, 2, 9), for a total sum of 4 + 8 + 0 + 9 = 21. (b) (15 points) Given a Cartesian coordinate value (a, b), write a function that sum up all values from (0,0) to (a, b) inclusive, by traveling along the x-axis first, and then the y-axis. The header of the function should look like int sum_vals (point_t*** my-grid, int rows, int cols, int a, int b); rows and cols are the size of the grid, as before. (15 minutes) For example, given the following 3x3 grid from before and if you call the function (0,2,7) (1,2,9) (2,2,3) (0,1,8) (1,1,0) (1,1,0)|(2,1,2) (0,0,4) (1,0,8)|(2,0,3) as follows: int sum = sum vals(my-grid, rows, cols, 1, 2); then the value in sum should be 21: Starting from (0, 0, 4), you pass through (1, 0, 8), (1, 1, 0), ending up at (1, 2, 9), for a total sum of 4 + 8 + 0 + 9 = 21

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

a. What is the purpose of the team?

Answered: 1 week ago

Question

a. How are members selected to join the team?

Answered: 1 week ago

Question

b. What are its goals and objectives?

Answered: 1 week ago