Can translate this to C++

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Can translate this to C++

# mark x, y as part of solution path
sol[x] [y] = 1
51
52
53
# Move forward in x direction
if solveMazeUtil (maze, x + 1, y, sol)
54
55
== True:
56
return True
57
# If moving in x direction doesn't give solution
# then Move down in y direction
if solveMazeUtil (maze, x, y + 1, sol)
58
59
60
== True:
61
return True
62
63
# If moving in y direction doesn't give solution then
64
# Move back in x direction
65
if solveMazeUtil (maze, x - 1, y,
sol)
== True:
66
return True
67
68
# If moving in backwards in x direction doesn't give solution
# then Move upwards in y direction
if solveMazeUtil (maze, x, y - 1, sol) == True:
69
70
71
return True
72
73
# If none of the above movements work then
# BACKTRACK: unmark x, y as part of solution path
sol [x] [y] = 0
74
75
Transcribed Image Text:# mark x, y as part of solution path sol[x] [y] = 1 51 52 53 # Move forward in x direction if solveMazeUtil (maze, x + 1, y, sol) 54 55 == True: 56 return True 57 # If moving in x direction doesn't give solution # then Move down in y direction if solveMazeUtil (maze, x, y + 1, sol) 58 59 60 == True: 61 return True 62 63 # If moving in y direction doesn't give solution then 64 # Move back in x direction 65 if solveMazeUtil (maze, x - 1, y, sol) == True: 66 return True 67 68 # If moving in backwards in x direction doesn't give solution # then Move upwards in y direction if solveMazeUtil (maze, x, y - 1, sol) == True: 69 70 71 return True 72 73 # If none of the above movements work then # BACKTRACK: unmark x, y as part of solution path sol [x] [y] = 0 74 75
76
return False
77
78 # Driver program to test above function
79 if
name
== " main ":
# Initialising the maze
maze = [ [1, 1, 1, 1, 1],
80
81
[1, 1, 1, 0, 1],
[о, 1, 1, о, 1],
[о, 1, 0, 0, 1],
[о, 1, 1, 1, 1]]
82
83
84
85
86
87
solveMaze (maze)
88
Transcribed Image Text:76 return False 77 78 # Driver program to test above function 79 if name == " main ": # Initialising the maze maze = [ [1, 1, 1, 1, 1], 80 81 [1, 1, 1, 0, 1], [о, 1, 1, о, 1], [о, 1, 0, 0, 1], [о, 1, 1, 1, 1]] 82 83 84 85 86 87 solveMaze (maze) 88
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education