rying to write a gravity function in C language

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 6E: (List maintenance) The following letters are stored in an alphabet array: B, J, K, M, S, and Z....
icon
Related questions
Question
100%

Trying to write a gravity function in C language

/**
* Function: gravity
Description: "compacts" the matrix/image downward according to the
following rules:
The character
represents Air
All other characters are assumed to be "heavier than air"
i.e., they will fall when the force of gravity is
applied.
Let's call them "blocks"
All blocks fall as far as possible as you might expect...
Estimated Difficulty: LEVEL 3
Example
Before Gravity:
8.
.^##..
#....#
#. #Q.$
&###.#
#林*
After Gravity:
#^#@.#
#^##8$
&###*#
void gravity(char **m, int n);
Transcribed Image Text:/** * Function: gravity Description: "compacts" the matrix/image downward according to the following rules: The character represents Air All other characters are assumed to be "heavier than air" i.e., they will fall when the force of gravity is applied. Let's call them "blocks" All blocks fall as far as possible as you might expect... Estimated Difficulty: LEVEL 3 Example Before Gravity: 8. .^##.. #....# #. #Q.$ &###.# #林* After Gravity: #^#@.# #^##8$ &###*# void gravity(char **m, int n);
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr