代做JAVA matrix 作业、代做JAVA课程设计作业、代写JAVA程序作业


CPSC 1160: ASSIGNMENT 3[25 MARKS]
Write a program that ask the user for two integers (between 1 and 10) which will be the number of rows
and columns in a matrix. Then your program should fill the matrix with random values between 1 or 20.
Your program then, should ask the user for a positive integer (lets call it n). Your program should then
find a continuous path thought the matrix starting at position 0,0 that will sum to n. Your program
should only move left (col -1), right(col +1), up (row -1) and down (row+1) and can only use a position
once in the sum. If there is such a path in the matrix, that path should be printed to console, using ‘V’
for down, ‘^” for up, ‘>’ for right,‘<’ for left, ‘X’ where the path ends and ‘-‘ for all other positions in the
matrix. Your solution should be recursive.
Examples 1
Number of rows(Max 10) 5
Number of cols(Max 10) 3
2 8 15
1 10 5
19 19 3
5 6 6
2 8 2
What sum are you looking for 73
V - -
V - -
V > V
V ^ V
> ^ X
Example 2
Number of rows(Max 10) 3
Number of cols(Max 10) 3
2 8 15
1 10 5
19 19 3
What sum are you looking for 19
No path found
Submissions
Make sure that your code is neat and is well commented
Check that all of your programs work the way they are intended to work by running them with different
inputs
Before the submission date test input will be giving, your program should run on those examples and
any other examples.
Submit to D2L a zip/archive file containing the .cpp and .txt you have written
If you do not zip your file or if you submit the .class files, you will receive ZERO for this lab
http://www.6daixie.com/contents/9/1468.html

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:[email protected] 

微信:codinghelp

猜你喜欢

转载自www.cnblogs.com/javastudying/p/9146914.html
今日推荐