联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2018-06-06 02:13

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


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp