Hi,
The part of the Palindrome is working but i want to my program to print "Press ENTER to continue" in the end of each cycle.
It is working but i donīt think that is the best way.
Code:
// Problem here - I Want to press enter to continue what is the best way ?
cin.get();
cout << "Press enter to continue";
cin.get();
FULL CODE
Code:
using namespace std;
string invertePalavra(string s) {
return string(s.rbegin(), s.rend());
}
void ficha1_ex8() {
string word;
cout << "Write \"end\" to exit\n";
while (true) {
cout << "Write a word: \n> ";
cin >> word;
if (word == "end")
break;
string inv = invertePalavra(word);
cout << "word -> " << word << endl;
cout << "Reverse word -> " << inv << endl;
if (word == inv) {
cout << "palindrome \n";
} else {
cout << "Not a palindrome\n";
}
// Problem here - I Want to press enter to continue what is the best way ?
cin.get();
cout << "Press enter to continue";
cin.get();
}
}
int main(int argc, char** argv) {
ficha1_ex8();
return 0;
}