-
Notifications
You must be signed in to change notification settings - Fork 0
/
StringMan.cpp
49 lines (39 loc) · 870 Bytes
/
StringMan.cpp
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
/*
Name: Norald Alejo
Email: [email protected]
Version: 1.00
*/
#include "StringMan.h"
using namespace std;
//Declares the word and displays the word entered
void stringCheck::setWord(string text){
word = text;
cout << "The word you entered is " << word << endl;
}
//Finds and returns the length of the word
int stringCheck::findLength(){
return word.length();
}
//Puts all characters in the word in lower case
void stringCheck::lowerCase(){
for (int i = 0; i < word.length(); i++){
word[i] = tolower(word[i]);
}
}
//Reverse and returns the reverse of the string
string stringCheck::reverseString(){
string temp;
for (int i = word.length() - 1; i >= 0; i--){
temp += word[i];
}
return temp;
}
//Checks if the word is a palindrome
bool stringCheck::isPalindrome(string other){
if (other == word){
return true;
}
else{
return false;
}
}