If and else Statements in While loop" for C++
<p>I have a question regarding if &amp; else statements in a while loop.</p>

<p>I wanted to establish a few things in my program:</p>

<ul>
<li>wanted user to only input 4 letter characters without the use of numbers and symbols.</li>
<li>converting each those letters into ints(Ascii val.)</li>
</ul>

<p>To make it easier to understand if confused,</p>

<p>Program 1st asks for 4 letter word.
User places input. If input contains at least:</p>

<ul>
<li>a non-letter character, then Program asks User for new Input.</li>
</ul>

<p>If input only contain letters Program checks input for # of letters.</p>

<p>If input doesn't have ___ :</p>

<ul>
<li>4 letters, Program asks User for new Input.</li>
</ul>

<p>Otherwise Program proceeds with determining Int value of each letter</p>

<hr>

<p>Okay so heres my Program so far: ** not sure if this correct for</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

int main() {
    string input;
    int input0 = input[0];  
    int input1 = input[1];  
    int input2 = input[2];
    int input3 = input[3];
    cout &lt;&lt; "\nEnter a 4-letter word (Keep it clean!).\n";
  while(cin&gt;&gt;input){
    cout &lt;&lt; endl &lt;&lt; input &lt;&lt; " has " &lt;&lt; input.length() &lt;&lt; " letters." &lt;&lt; endl; 
        if (int(input[0]) &gt; 64 || int(input[0]) &lt; 91 || int(input[0]) &gt; 96 || int(input[0]) &lt; 123 || 
            int(input[1]) &gt; 64 || int(input[1]) &lt; 91 || int(input[1]) &gt; 96 || int(input[1]) &lt; 123 ||
            int(input[2]) &gt; 64 || int(input[2]) &lt; 91 || int(input[2]) &gt; 96 || int(input[2]) &lt; 123 ||
            int(input[3]) &gt; 64 || int(input[3]) &lt; 91 || int(input[3]) &gt; 96 || int(input[3]) &lt; 123) {
                if (input.length()!=5 &amp;&amp; input.length()&gt;3)
                    cout &lt;&lt; "\n the int value of the " &lt;&lt; input[0] &lt;&lt; " is " &lt;&lt; int(input[0]) &lt;&lt; endl;
                    cout &lt;&lt; "\n the int value of the " &lt;&lt; input[1] &lt;&lt; " is " &lt;&lt; int(input[1]) &lt;&lt; endl;
                    cout &lt;&lt; "\n the int value of the " &lt;&lt; input[2] &lt;&lt; " is " &lt;&lt; int(input[2]) &lt;&lt; endl;
                    cout &lt;&lt; "\n the int value of the " &lt;&lt; input[3] &lt;&lt; " is " &lt;&lt; int(input[3]) &lt;&lt; endl;
                else cout &lt;&lt; input &lt;&lt; "is not a 4-letter word.\nPlease try again." &lt;&lt; endl;
        }
        else cout &lt;&lt; input &lt;&lt; " contains number(s) and or symbol(s).\nPlease try again." &lt;&lt; endl;
  }
}
</code></pre>

<p>I got 2 errors:</p>

<ul>
<li><blockquote>
  <p>error: expected '}' before 'else'</p>
</blockquote></li>
<li><blockquote>
  <p>error: 'else' without a previous 'if'</p>
</blockquote></li>
</ul>