subject

In C++ programming language Jump Game
Goals
Practice getting input from the command line
Review solving problems with recursion
Matthew’s Stats
Time taken: 40 minutes
Files: 3
Lines of Code: 116 including whitespace and comments
Restrictions and Requirements
No global variables may be used
Your submission must contain at least 2 or more .cpp files and one or more .h files
Problem Description
You are given a list of integer numbers. Each number tells you how far to the right or left you can move from that spot. You can only move exactly that many spaces. Moving from one number to the next is considered a move. Your goal is to find the sequence of moves that get you from the first number to the last number in the fewest moves possible. If however, there is no sequence of moves that will get you to the end, then you should state that. For example, if you were given the list
Index 0 1 2 3 4 5 6
Value 1 2 4 1 1 1 7
Then the smallest sequence of moves that gets you from index 0 to index 6 is {0, 1, 3, 2, 6}.
Input
Command Line Arguments
Will always be valid
The list of integers to solve
Each integer will have a value greater than or equal to 0
Standard Input
None
Implementation
You will find recursion to be very helpful in solving this problem.
When solving the problem, first go to the left and then go right
This will help us to have the same solution if there are multiple equally valid solutions
If a move would take you out of bounds of the list, for example, before the first entry or after the last entry, it is invalid and should not be taken
Examples
Example 1
./JumpGame 1 2 4 1 1 1 7
The solution is: {0, 1, 3, 2, 6}
Example 2
./JumpGame
There is no solution to the given game.
What to Submit
A zip file containing
The .cpp and .h files that make up your solution
A CMakeLists. txt file that will generate an executable named JumpGame from your .cpp and .h files
Make sure to zip the files you want to submit and NOT the folder that contains the files. Submitting the folder with the files will cause your program to fail to build.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
Knowing that the central portion of link bd has a uniform cross sectional area of 800 mm2 , determine the magnitude of the load p for which the normal stress in link bd is 50 mpa. (hint: link bd is a two-force member.) ans: p = 62.7 kn
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
question
Computers and Technology, 23.06.2019 03:10
Fill in the following program so that it will correctly calculate the price of the orange juice the user is buying based on the buy one get one sale.#include //main functionint main() { int cartons; float price, total; //prompt user for input information printf("what is the cost of one container of oj in dollars? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & price); printf("how many containers are you buying? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & cartons); if ( [ select ] ["cartons / 2", "cartons % 1", "cartons % 2", "cartons % price", "cartons / price", "cartons / total"] [ select ] ["=", "==", "! =", "< =", "> =", "< "] 0) total = [ select ] ["price * cartons", "cartons * price / 2 + price", "(cartons / 2) * price", "cartons / (2.0 * price)", "(cartons / 2.0) * price + price", "((cartons / 2) * price) + price"] ; else total = ((cartons / 2) * price) + price; printf("the total cost is $%.2f.\n", total); return 0; }
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
You know the right answer?
In C++ programming language Jump Game
Goals
Practice getting input from the command li...
Questions
question
Physics, 09.12.2019 05:31
question
Mathematics, 09.12.2019 06:31