// Program file: strmanip.cpp // Demonstrates character manipulations with in strings #include using namespace std; typedef char str[11]; str& getData(); void printBackwards(str w); int main() { str word; char done = 'N'; strcpy(word, getData()); while (done == 'n' || done == 'N') { printBackwards(word); cout << "Done entering words (Y/N): "; cin >> done; if (done == 'n' || done == 'N') strcpy(word, getData()); } system("pause"); return 0; } str& getData() { static str w; cout << "Enter a word: "; cin >> w; return w; } void printBackwards(str w) { for (int i = strlen(w)-1; i >= 0; --i) cout << w[i]; cout << endl; }