-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.cc
145 lines (132 loc) · 4.24 KB
/
functions.cc
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
#include "functions.hpp"
#include <iostream>
/**
* TODO: Implement this function
* @param word word to change to lowercase
* @return result of changing every character in word to lowercase
*/
std::string StringToLower(const std::string& word) {
std::string new_word = word;
for (char c : new_word) {
c = std::tolower(c);
}
return new_word;
std::cout << "Input to StringToLower() : " << word << std::endl;
}
/**
* TODO: Implement this function
* @param v1 first character in potential vowel group
* @param v2 second character in potential vowel group
* @return true if v1 and v2 form a valid vowel group
*/
bool IsVowelGroup(const char& v1, const char& v2) {
std::cout << "Input to IsVowelGroup() : \"" << v1 << "\" \"" << v2 << "\""
<< std::endl;
return true;
}
/**
* TODO: Complete this function
* @param v potential vowel character
* @return true if v is a vowel
*/
bool IsVowel(const char& v) {
std::cout << "Input to IsVowel() : \"" << v << "\"" << std::endl;
return true;
}
/**
* TODO: Complete this function
* @param c potential consonant character
* @return true if c is a consonant
*/
bool IsConsonant(const char& c) {
std::cout << "Input to IsConsonant() : \"" << c << "\"" << std::endl;
return true;
}
/**
* TODO: Implement this function
* @param c character to check validity of
* @return true if input c is a valid character in the Hawaiian language, false
* otherwise
*/
bool IsValidCharacter(const char& c) {
std::cout << "Input to IsValidCharacter() : \"" << c << "\"" << std::endl;
return true;
}
/**
* TODO: Implement this function
* @param word word to check validity of
* @return true if every character in word is a valid character in the Hawaiian
* language, false otherwise
*/
bool IsValidWord(const std::string& word) {
std::cout << "Input to IsValidWord() : " << word << std::endl;
return true;
}
/**
* TODO: Implement this function
* @param c consonant to get pronunciation of
* @param prev character before c, used for determining w translation
* set to null character as default if no value is passed in
* @return pronunciation of the consonant c as a string
*/
char ConsonantPronunciation(const char& c, const char& prev) {
std::cout << "Input to ConsonantPronunciation() : \"" << c << "\" \"" << prev
<< "\"" << std::endl;
return '\0';
}
/**
* TODO: Implement this function
* @param v1 first vowel in a vowel grouping
* @param v2 second vowel in a vowel grouping
* @return the pronunciation of the vowel grouping made up of v1 and v2
* as a string
*/
std::string VowelGroupPronunciation(const char& v1, const char& v2) {
std::cout << "Input to VowelGroupPronunciation() : \"" << v1 << "\" \"" << v2
<< "\"" << std::endl;
return "";
}
/**
* TODO: Implement this function
* @param v single vowel to get pronunciation of
* @return the pronunciation of v as a string
*/
std::string SingleVowelPronunciation(const char& v) {
std::cout << "Input to SingleVowelPronunciation() : \"" << v << "\""
<< std::endl;
return "";
}
/**
* TODO: Implement this function
* @param prev first character in set of three passed to function
* @param curr second character in set of three passed to function
* @param next third character in set of three passed to function
* @return pronunciation of curr using next and prev as needed to determine
* result
*/
std::string ProcessCharacter(const char& prev,
const char& curr,
const char& next) {
std::cout << "Input to ProcessCharacter() : \"" << prev << "\" \"" << curr
<< "\" \"" << next << "\"" << std::endl;
return "";
}
/**
* TODO: Implement this function
* @param word string to get pronunciation of
* @return pronunciation of word
*/
std::string Pronunciation(const std::string& word) {
std::cout << "Input to Pronunciation() : " << word << std::endl;
return "";
}
/**
* TODO: Implement this function
* @param hawaiian_word word to get pronunciation of
* @return the pronunciation of hawaiian_word as a string if valid
* and throws an invalid_argument error if not valid
*/
std::string GetPronunciation(const std::string& hawaiian_word) {
std::cout << "Input to GetPronunciation() : " << hawaiian_word << std::endl;
return "";
}