title: Loop to print string backwards
body: <p>Program asks user for a series of strings (their name and an 8 letter word), prints their name, the first and last three letters of the word, and then prints their word backwards. need help with the for loop to display string backwards. </p>
  
  <pre><code>    #include &lt;iostream&gt; 
  
  int main () { 
  
  
  string FirstName; 
  
  string LastName; 
  
  string MiddleName; 
  
  string Names; 
  
  string string1; 
  
  int len; 
  
  int x;  
  
   cout &lt;&lt; "Hello. What is your first name?" &lt;&lt; endl; 
  
   cin &gt;&gt; FirstName; 
  
   cout &lt;&lt; FirstName  &lt;&lt; ", what is your last name?" &lt;&lt; endl; 
  
   cin &gt;&gt; LastName; 
  
   cout &lt;&lt; "And your middle name?" &lt;&lt; endl; 
  
   cin &gt;&gt; MiddleName; 
  
   Names = LastName + ", " + FirstName + ", " + MiddleName; 
  
   cout &lt;&lt; Names &lt;&lt; endl; 
  
   cout &lt;&lt; "Please enter a word with 8 or more characters (no spaces): " &lt;&lt; endl; 
  
   cin &gt;&gt; string1; 
  
   len = string1.length(); 
  
     if (len &lt; 8){
       cout &lt;&lt; "Error. Please enter a word with 8 or more characters and no spaces: " &lt;&lt;    endl; 
  
       cin &gt;&gt; string1; 
   }
  
    else if (len &gt;= 8){
  
       cout &lt;&lt; "The word you entered has " &lt;&lt; string1.length() &lt;&lt; " characters."&lt;&lt;endl; 
  
   cout &lt;&lt; "The first three characters are " &lt;&lt; string1.substr(0,3) &lt;&lt; endl; 
  
   cout &lt;&lt; "The last three characters are " &lt;&lt;string1.substr(string1.length()-3,3) &lt;&lt; endl; 
  
  x = string1.length()-1; 
  
  for (x = string1.length()-1; x &gt;=0; x--){
   cout &lt;&lt; "Your word backwards: " &lt;&lt; string1[x]; 
  }
  }
  
  
  
  return 0; 
  } 
  </code></pre>