Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: dslong1 on Jun 21st, 2012  |  syntax: None  |  size: 0.68 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. 1.
  2. //Greg's For Test
  3.  
  4.  2.
  5.  
  6.  
  7.  3.
  8. #include <iostream>
  9.  
  10.  4.
  11. #include <string>
  12.  
  13.  5.
  14.  
  15.  
  16.  6.
  17. using namespace std;
  18.  
  19.  7.
  20.  
  21.  
  22.  8.
  23. int main()
  24.  
  25.  9.
  26. {
  27.  
  28.  10.
  29.         string word;
  30.  
  31.  11.
  32.         string reverseWord;
  33.  
  34.  12.
  35.  
  36.  
  37.  13.
  38.         cout << "Enter a word: ";
  39.  
  40.  14.
  41.         cin >> word;
  42.  
  43.  15.
  44.         cout << "\nYour word was " << word << ".\n\n";
  45.  
  46.  16.
  47.         cout << word << " in reverse is: \n\n";
  48.  
  49.  17.
  50.  
  51.  
  52.  18.
  53.         for (unsigned i = word.length(); i > 0; i--)
  54.  
  55.  19.
  56.         {
  57.  
  58.  20.
  59.                 cout << word[i-1];
  60.  
  61.  21.
  62.         }
  63.  
  64.  22.
  65.  
  66.  
  67.  23.
  68.         cout << endl << endl;
  69.  
  70.  24.
  71.        
  72.  
  73. 25.
  74.         return 0;
  75.  
  76.  26.
  77. }