-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
45 lines (33 loc) · 923 Bytes
/
main.cpp
File metadata and controls
45 lines (33 loc) · 923 Bytes
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
/*
Name: Norald Alejo
Email: norald.alejo@gmail.com
version 1.00
*/
#include "StringMan.h"
using namespace std;
int main(){
//Intializes variables and class
string name, word, reverse;
stringCheck text1;
//Asks user for name
cout << "Hello! What is your name? ";
getline(cin, name);
//Asks user to enter a word
cout << "Hi " << name << "! Please enter a word or a sentence: ";
getline(cin, word);
//Sets word to manipulate and puts all characters to lower case
text1.setWord(word);
text1.lowerCase();
//Reverses the word
reverse = text1.reverseString();
//Prints out the reversed word
cout << "The reverse of \"" << word << "\" is \"" << reverse << "\""<< endl;
//Checks if the word is a palindrome
if (text1.isPalindrome(reverse)){
cout << "This string is a palindrome." << endl;
}
else {
cout << "This string is not a palindrome." << endl;
}
cout << "See you later!!" << endl;
}