Earn Higher Grades With Instant Assignment Help.Ask Question!

C Programming
(5/5)

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)

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

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. The LineItem class will represent an individual

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

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
657 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
586 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
940 Answers Hire Me