/* Examples for a 'C++ 101' class I was helping out with.. This example shows how to reverse a word while using temp variables. Add a 'cin.get()' if output is going by too fast., (LogicKills) */ #include #include int main() { using namespace std; cout << "Enter a word "; string word; cin >> word; char temp; int i, j; for (j = 0, i = word.size() - 1; j < i; --i, ++j) { temp = word[i]; word[i] = word[j]; word[j] = temp; } cout << word <<"\nDone"; return 0; }