-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatrix_search.h
74 lines (58 loc) · 2.33 KB
/
matrix_search.h
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
/**
matrix_search.h -- These are your function declarations. These are your function declarations. Do not edit this file. We will ignore this file upon submission. If you change it and your program does not run as a result, you will receive a grade of %10.
**/
#ifndef WORD_SEARCH
#define WORD_SEARCH
#include <iostream>
#include <string> // optional with modern GCC installs
using std::cout;
using std::endl;
using std::cin;
using std::string;
/*
Returns a string array containing the your (the student author’s) Campus Username (at index 0) and Student ID# (at index 1). Takes as input a pre-existing length-2 string array.
-- Example:
-- cout << id_array[0]; // outputs janexc3
-- cout << id_array[1]; // outputs 12345677
*/
void get_identity(string my_id[]);
/*
Builds a Two Dimensional array of the given size
-- cols: The number of columns in the matrix
-- rows: The number of rows in the matrix
-- **matrix: A pointer to a matrix to be built, which is not initialized yet, but merely declared before being a parameter here.
-- returns a ponter to a pointer to a char, which is the pointer to the matrix
*/
char ** build_matrix(int rows, int cols);
/*
Fills a matrix from std in (command line terminal input)
-- cols: The number of columns in the matrix
-- rows: The number of rows in the matrix
-- **matrix: The matrix to be filled
-- Should simply accept input via cin or getline, etc.
*/
void fill_matrix(int rows, int cols, char **matrix);
/*
Modifies sol to contain the locations of the start and end characters of the word.
-- sol: 4-large array of ints, where ind 0: row start, ind 1: col start, ind 2: row end, ind 3: col end
-- word: the word being searched for
-- rows: the number of rows in the matrix
-- cols: the number of columns in the matrix
-- **matrix: pointer to a dynamically allocated array containing the characters to be searched
-- if the solution does not exist in the matrix, set the 4 values of sol all to -1
*/
void matrix_search(int sol[], string word, int rows, int cols, char **matrix);
/*
Prints the matrix as follows:
a a a
a a a
a a a
*/
void print_matrix(int rows, int cols, char **matrix);
/*
Deletes a two dimensional dynamically allocated matrix
-- rows: The number of rows in the matrix
-- **matrix: the matrix to be deleted
*/
void delete_matrix(int rows, char **matrix);
#endif