logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Nagendra Singh ChauhanMathematics
(/5)

740 Answers

Hire Me
expert
Bill BattershillPhilosophy
(5/5)

659 Answers

Hire Me
expert
Ishrat KhanAccounting
(/5)

894 Answers

Hire Me
expert
Expert TeamComputer science
(5/5)

993 Answers

Hire Me
C Programming

In this assignment, you are going to implement a cheating program for word puzzles. The user will enter the word to be searched, and your program will determine where it starts in the puzzles.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

ASSIGNMENT 7

In this assignment, you are going to implement a cheating program for word puzzles. The user will enter the word to be searched, and your program will determine where it starts in the puzzles.

Assume that you have a 12x15 puzzle. The contents of the puzzle should be the same with the one in the following example (Figure 1).

 

0        1        2       3          4          5       6        7      8         9      10        11

X

T

Z

M

Q

Y

K

C

E

C

F

H

S

H

O

U

T

E

X

O

E

A

P

I

X

G

T

L

Q

B

E

L

T

N

F

K

A

I

R

I

D

Z

A

L

I

O

D

M

M

E

I

E

T

Y

S

E

H

R

T

I

A

W

B

R

N

E

T

C

W

O

H

X

N

O

U

I

R

U

Z

T

S

C

C

T

U

D

T

P

E

C

J

I

E

H

R

U

A

L

E

M

C

S

Y

O

N

I

U

R

L

V

K

E

R

E

M

N

I

P

H

E

E

A

N

B

U

R

E

J

O

N

C

Y

A

W

I

I

I

J

N

J

R

U

Y

F

D

W

T

N

T

H

E

N

P

J

Y

T

E

Q

L

Z

D

I

L

E

M

M

A

B

R

C

I

T

E

N

G

A

M

T

P

C

 

 

Another trivial task is to implement a function which computes the length of a given string, since you are not allowed to use built-in string functions such as strlen.

The main challenge of this assignment is to implement the function which actually searches the string in the puzzle. Note that the word may be written in the puzzle from left to right, right to left, top to bottom and eventually bottom to top.

●     Function 1 (15 pts):

  • Name of the function: printPuzzle

○     Return type of the function: void

  • Parameter: a character matrix

  • In this function, you will print the word puzzle which is the content of the character matrix as in the example Assume that the word puzzle will be 12x15 character matrix.

●     Function 2 (15 pts):

  • Name of the function: computeLength

○     Return type of the function: int

  • Parameter: a string

  • In this function you will compute and return the length of the input Note that, you are not allowed to use built-in string functions such as strlen.

●     Function 3 (40 pts):

  • Name of the function: findString

○     Return type of the function: int

  • Parameter: a character matrix

  • Parameter: a string

  • Parameter: an integer value (length of the string in 2nd parameter)

  • In this function, you will search the string in the character matrix. If found, the function returns the index of the starting point of the string in the character If not found, the function returns -1.

  • Index values of character matrix are as follows:

0

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

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

Figure 3: Puzzle Indexes

●     Main function:

  • In the main function, you will take the puzzle from the user line by line where each line is a string with 12 letters. (15 pts)

  • Then, you will print the puzzle on the screen by calling printPuzzle

  • Finally, you will ask the string to be searched from the user continuously. If the user enters ‘q’ or ‘Q’, terminate the program, otherwise find the starting position of the string in the puzzle by calling findString function and print it on the (15 pts)

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme