首页 > > 详细

C++辅导迷宫寻路小程序、辅导CS32 Path Exists辅导留学生C/C++设计

C++,,。
 

Problem 1

Here are five functions, with descriptions of what they are supposed to do. They are incorrectly implemented. Replace the incorrect implementations of these functions with correct ones that use recursion in a useful way; your solution must not use the keywords while, for, or goto. You must not use global variables or variables declared with the keyword static, and you must not modify the function parameter lists. You must not use any references or pointers as parameters except for the parameters representing arrays.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Returns the product of two positive integers, m and n,
// using only repeated addition.
int mult(unsigned int m, unsigned int n)
#123;

return -1; // This is incorrect.
#125;

// Returns the number of occurrences of digit in the decimal
// representation of num. digit is an int between 0 and 9
// inclusive.
//
// Pseudocode Example:
// countDigit(18838, 8) =gt; 3
// countDigit(55555, 3) =gt; 0
// countDigit(0, 0) =gt; 0 or 1 (either if fine)
//
int countDigit(int num, int digit)
#123;

return -1; // This is incorrect.
#125;

// Returns a string where the same characters next each other in
// string n are separated by "++"
//
// Pseudocode Example:
// pairPlus("goodbye") =gt; "go++odbye"
// pairPlus("yyuu") =gt; "y++yu++u"
// pairPlus("aaaa") =gt; "a++a++a++a"
//
string pairPlus(string n)
#123;

return ""; // This is not always correct.
#125;

// str contains a single pair of parenthesis, return a new string
// made of only the parenthesis and whatever those parensthesis
// contain.
//
// Pseudocode Example:
// subPare…⁴⁧と䌻ⵧㅴ⸻㰠⼦㹯൴਻
⁧⁨㰩㹵‼‼‾⁰⁣㨽•Ɱ⁥㬼⁳†⁳⁴ †⁐ち⁲⁴⴦ㅱⱵ††※※
⁵‼‾〼 ⁲䌯⵰ㅡ⹮㰠⽣㹳൳਽㰢⽬㹥ഢਾ㰼㹰䡡⁳⁣‾††⁡…※㔴⁡
㝴※㩧㱴⼻㸦൱ੵ㱯㹹㰩㹴㭰㭢൲ਠ㭰⹮⸠⹣䁡㭩൮੥㭰⹣⹡㭯൭੭㬾䀯⸼ⸯ⹳⹰㭳൰੡㭲㭡൳ੳ㰽⼢㸢㰾⼼㹮ഠ੣㱬㹳⁦‾‽⁩‾⁩⁳‼⁳⁴⁢⁥Ɱ‾†⁡⁳⁲‾‽⁵⁰‼ⰼ⁢ ※⁳‼†㬽•†⁰⁥⸢‾⁵⁳‾⁡ⱳ⁳Ⱳ⁩ⱱ⁵‪ⱴ※⁰※⹡⁳⁩Ᵽ⁥‮⁳‾†⁰†⁳‼⁰‼⸠㰯⼾㹳൰੡㱮㹣⡬‽⁡⁣‽⠢っⱯね⥭⁥•†⁵⡥⁨⥭†Ⱐ⁣†⡯⥥⁩⁨⁰⁢‾⠠⤽•‾⁡⸠⥥㱱⽵㹬൳ਠ㱴㹥䠠⁵⁥ ‾㩢㱲⼠㸾഼ੳ㱰㹣㱬㸢䥬‼⁣‼⁰‼‼ⱡ⁳㭥഼ੳ⁰⁡†•ⰾ †⁣⹅൸੡䵭›⁰⁳ ⁳⹡൳ੳ䘽⁩‼⁡•Ⱟഠਠ†††⁳䥵⁃⁩′‬††‽ ⡳‼⁡ഠਯ‾‼⁳⁰⤽•Ᵽ൬੡⁳⁳‽•⁣‾†䕭‬‸‬※⠠൥਼ ⁳⁰⁡‾‼ ⁳⁰⁡‾⁰⁣‽‾⁡‽൮ੴ•‾  †††††⁳⁵⁴⥛⸲ബਠ‴‬†‸⁝‬†″‬䤠‱⁴ ⰾ഼ਯ⁳⁰⁡‾‼⁢⁲† ‾‼⁳⁣⸾഼ੳ⁡⹯൭੭㱥⽮㸯㰠⼠㹳൵੭㱃㹭⡢䥩⁡Ⱐ‰
††⁥⁰‼‾⁣⁥⁰†‼⁰⹰⥡㱮⼾㹢൲ਠ㰯㸼䡳†⁡•⁩⁰⁡•⁴㩡㱮⽡㹳൳਽㰢⁤㵬∼⁰⭮⬠≣㹬㱡⽳㹬൥ਢ㰾㹭ൢ੩⁡⁴⁩㱯㹡൮ਾ‼⁳⁰⁡†⁣㱡㸽ഢੰ⁡⁲⁡⁳•‾
‼⁳⁰⁡㱮㵫≥∾㹣൯੮⁳⁴‼ ⁳⁰⁡‾†‼⁳㱰㹣㱬•㵲≤≴㸼ㄯ㱳⽰㹡㱛†⼼㹳㱰㵫≥≤㸢㈾㱩⽮㹰㱡†⽳㹩㱺⁳㵬≡≫㹥㍹㱷⽯㹩㱮 ⽳㹰㱡⁡㴼∯∾㸼㐯㱳⽰㹢㱲‾⼣㸱㰲⁳㵢≲≳㹰㕡㱮⼠㹳㰽⁩⽮㹥㰢†㴠≣∽㸢㙫㱥⽹㸢㰾⁴⽵㹲㱮⁡㵰≡≡㹳㝳㰽⼢㹲㱡‾⽦㹡㱬⁳㴠∠≮㸠㡣㱬⽡㹣㱯⁥⽮㹴㰢⁔㵳∠≡㹬㥷㱡⽹㹲㱲⁴⼮㸼㰯‾㵮∾∯㸾ㄼび㱰⽡㹡㱳•⽬㹩㱮‱㵳≰≢㹲ㄠㄯ㰾⼼㸾㰍†⼠㸠㰠†㵤∾∠㸠ㄠ㈠㰠⼠㸾㰍†⼠㸠㰼⁤㴯≴∾㸍ㄊ㌼㰯⽰㹨㰲⁤⼽㸢㱐⁥㵐≲≭㸠ㄲ㐼㰯⽨㸼㱰⁲⽩㹴㱥‫㵣≴≮㹡ㅭ㕥㱤⼠㹅㱸⁴⽳㸠㱴⁤㵩≮≨㹥ㅴ㙨㱥⽲㹮㱯⁡⼠㹴㱨⁲㵳∠≴㹨ㄠ㝦㱲⽯㹡㱲⁴⽯㸠㱦⁨㴠≲≮㹧ㅵ㡬㱡⽲㹥㰮⁥⽲㹥㰠⁨㵴≯∺㸼ㅢ㥲㰠⼯㹦㱩⁲⽥㸠㱣‽㵬≩≣㸫㈫〢㰾⼼㹵㱲‍⼊㸼㱴⽡㸾഍ਊ††††‼⁴⁢⁤⁹‾‍㰊⼠㸠ഠਠ††‼⁴⁲‾‍ ††††㰠†㵴≤≳㹳ഽਢ⁧⁵⁴⁴⁥⁲•‾‍ ††㰠㸠㰠‼㵳≰≬㹡㱳⁩㴼∯∠㸯㰾㵳∽∲㸼㱡⽮㸠 㰾㵳∽∢㸾㱰⽡㹲㰠⁰㴠∠∠㸠⠠⤠㰼⼯㸊㰠⼠㸠㰠†⼠㸼⍴ㅤ㈠㍣㭬㱡⽳㹯㱤‾⼍㸊㰠†㴠∼∼㹳⁰⁡㱮⁳㵮≥≣㹬㱵⽮㹮•㱮⁳㵹≷≯㹯ㅬ〼㰯⽳㸠⁳㵰⁡⍮ㄠ㉣㍬㭡㱳⽳㹴㱬‾⽰㹡㱴⁳㵰≡≰㹡†⁣㱡⁰㴢∾∠㹣♬㬢♳㭧㰼⼯㸾Ⱐ㱭⽡㸬㰠⁰⽡㹮㰠⁳㵷≯≩㹮⁴‼ ⁳㱰㴠∼≬㹡♳㭥⹷⹯⹲⹤⸢⸾⹩䁮☼㭮㰾⼠㹳Ⱜ㰠⼼㸠㱣⁳⽳㸽㰢㵮≴≡㹮‾†⁳⁲㰬⁡㵳≳≯㹲♤㭴䁳䁡䁮⸾☬㭡㱮⼠㹳ⰽ㰢⽫㹲㱤⁩⽮㹴㰼㴠∼∠㹣⁡⁳⁳㰽⁷㵩≮≮㸾☠㬯⹰⹡⸾ⸯ⹳⹰♮㭳㱰⽡㹲Ⱐ㰯⼾㹮㰠⁡⽳㹳㰽⁥㵳≰≬㹡⁳⁳‽•㱣㴠≒≴㹲♵㬠⹨⹥⹥⸠⹩䁳⸠☠㬠㱦⽲㹳Ⱳ㰬⽳㹯㰠⁲⼬㹥㱣⁰㵳≰≢㹲† ‾‼㱳⁣㴢≬∠㸼♳㭣⹡⹳⹳⸽⹭♥㬯㰯⼠㹵Ⱨ㱨⼠㹭㱡※⼠㹲㱥†㴠≯≷㹩⁳⁥‼ 㱳‼㴾∼∯㹰♲㬠䀠⸠⸠⸠⸠☠㬾㰍⼊㸠Ⱐ㰠⼠㸾㰍†⼠㸠㰼⁤㴯≴∾㸍 ‼ ⁰㰾‾㵡≲≳㸠♡㭰⸍⸊⹬⸊☠㭩㰾⽁㹴ⱡ㱮⽧㸠㱭⁥⼠㹯㱦⁡㵴≳≴㸠⁲⁥⁰⁲㱥⁳㵭≡≣㹨☠㭮⸠⹯⹦⹴⹨⹥⸠♲㭩㱳⼠㹷Ⱐ㱯⽦㸠㱭⁥⼮㸼㰯 㵬≩≨㸠…⁳ⁱ㱵⁲㴠≲≮㹴♳㭡♬㬻㱀⼦㹯㰻⼠㹥㱳⁴⽳㸠㱡⁴㵳∠∠㹨⍥ㄬ㈠㕡㭮㭤㰠⽥㸦㱬⁵⽯㸻㰮⁵㵰≲≴㹳†⁡†⁷⁡⁷㱡⽹㹩㰾†⼠㸠㰠⁔㵭≢≦㸠⁲㱷†㵡≺∍㸊㰠⼠㹔⁨⡥䕢⠠Ɑ㱳⁴㵺≥∠㹳ㅴひ㱩⽮㸠ⱴ㱨⁺㵡≭≵㹳ㅴ〠㱢⽥㹳Ⱐ㱥‮㴍∊≩㸾㙔㱨⽥㹲ⱴ㱩㵡≴≴㹨㑥㰠⽭㸠ⱳ⁲㰬†㵯≷≲㸠ㅩ㱳⼠㹨ⱥ㰠⁥㵲≯≯㹷ㅳ㰭⼱㹤⤠⥴㱨⽥㹵㱭⽵㹭㱢⁳㴀∀∀㸀    㰀 㴀∀∀㸀㰀⼀㸀 㬀㬀 㰀 㴀∀∀㸀☀㬀℀☀㬀㰀⼀㸀 㬀㬀 㰀 㴀∀∀㸀㰀⼀㸀㬀㰀⼀㸀㰀 ⼀㸀㰀 㴀∀∀㸀  㰀 㴀∀∀㸀㰀⼀㸀㰀⼀㸀㰀 ⼀㸀㰀 㴀∀∀㸀    㰀 㴀∀∀㸀㰀⼀㸀 㬀㬀 㰀 㴀∀∀㸀☀㬀  ℀☀㬀㰀⼀㸀 㬀㬀 㰀 㴀∀∀㸀㰀⼀㸀㬀㰀⼀㸀㰀 ⼀㸀㰀 㴀∀∀㸀⌀㄀㈀㔀㬀㰀⼀㸀㰀 ⼀㸀㰀⼀㸀ഀ਀            㰀⼀㸀ഀ਀        㰀⼀㸀ഀ਀    㰀⼀㸀ഀ਀㰀⼀㸀ഀ਀㰀⼀㸀ഀ਀㰀㸀䈀          Ⰰ  ☀㬀           ⸀ 䤀 Ⰰ         ⠀⸀⸀Ⰰ        ⤀㨀㰀⼀㸀ഀ਀㰀㸀ഀ਀    㰀㸀      ⠀ ☀㬀    ⤀㬀㰀⼀㸀ഀ਀    㰀㸀        䌀㬀㰀⼀㸀ഀ਀    㰀㸀    Ⰰ 䀀Ⰰ        㬀㰀⼀㸀ഀ਀    㰀㸀          Ⰰ       㬀㰀⼀㸀ഀ਀    㰀㸀        ⴀ㄀Ⰰ          䌀ⴀ㄀㬀㰀⼀㸀ഀ਀    㰀㸀    ☀㬀⸀☀㬀 ⠀⸀⸀Ⰰ      ⤀㰀⼀㸀ഀ਀㰀⼀㸀ഀ਀㰀㸀⠀ Ⰰ           Ⰰ    ☀㬀          ⸀⤀㰀⼀㸀
联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!