102 HW 06
102 HW 06
deblankRe ur!ive that takes a string output and a string input argu ent and returns a copy of the input argu ent with a!! "!anks re o#ed$ %Write this function "oth iterati#e and recursi#e as deblankIterative and deblankRe ur!ive&
2) Write a progra
these ru!es: i) (f noun ends in y) re o#e the y and add ies ii) (f noun ends in s) ch or sh add es iii) (n a!! other cases) *ust add s print each noun and its p!ura!$ 'ry the fo!!owing data: chair dairy "oss circus f!y dog church c!ue dish
represents a maze. Each position can contain either an X or a blank. The borders of the maze are covered by X! except start and exit points. "ead text file as a character array and find start and finish points on the array borders #it doesn$t matter %hich one is start or finish point& 'ind a path from start point to the finish point. (nly horizontal and vertical moves are allo%ed.#right) left) *p and do%n&. If no path exists) %rite a message indicating there is no path. If there is a path to the exit location) mark the path %ith +(, and display the sol*tion maze on the screen. -oves can be made only to locations that contain a blank. If an X is enco*ntered) that path is blocked and another m*st be chosen. .se rec*rsion. The test mazes are given and example maze is at the second pages/
+$ ,W-.09+0/000.123'.+$c
,W-.09+0/000.123'.2$c ,W-.09+0/000.123'.3$c
x x x x x x x x x x x x x x x x x x x o x
x o o o o o o o o o o o o o o o o o x o x
x o x x x x x x x x x x x x x x x o x o x
x o x o o o o o o o o o o o o o x o x o x
x o x o x x x x x x x x x x x o x o x o x
x o x o x
x o x o x x x x x x o x o x o x o x o x
x o x o x
x o x o x
x o x o x
x o x o x
x o x o x
x o x o x
x o o o x
o o o x o x o x o x
x x x x x x o o x x o o x x o o x x o o x x o o x x
x x x x x x x x o x x o o o o x x x o o o x x x o o o x x x o o x x o x x x x o x x x o x o x
o x o o o x o x
x x x x x
x x x x x x x x x x x o o x o x x o x x o x o o x x x x o o x x o x x o x x o x o o x x x x x x x x
x o x x x x x x x x x x x x x x x x x x x x x x x x x
x x x o x x o x o x o o x o o x o o x o o x o o x o o x o o x o o x o o x o o x o o x o o x o o o o x x