Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[C++] Grass field Write a program input information of field also a command for cow to eat grass, and for gardener to grow grass.Then show
[C++] Grass field Write a program input information of field also a command for cow to eat grass, and for gardener to grow grass.Then show the output of a field after all command. Input First line specify integer N and M (3N 100, 1M1,000) represent size of field and number of another N lines, each line have N character show map of field. another M lines, each line contain 1 character for specify command and interger to specify row or column (1 1 is top-left, N N is bottom-right) .' represent blank space nothing there x' represent grass # represent rock Lk command cow to eat grass on row k, by starting from leftmost and walk to right Rk command cow to eat grass on row k, by starting from rightmost and walk to left Uk command cow to eat grass on column k, by starting from uppermost and walk down D k command cow to eat grass on row k, by starting from bottom and walk up Ak command gardener to grow grass on row k, Exept block that is rock Bk command gardener to grow grass on column k, Exept block that is rock NOTE k is integer from 1 to N Output Have N lines, each line have N character show map of a field after all commands Example1 Example2 Input 5 3 Output Output nput 5 4 X#XXX X#XXX L3 U 4 L5 D 4 U 4 B3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started