title: Isalpha() function with while loop c++
body: <p>I want to create a <code>while</code> loop that will allow me to input a mix of string numbers until I input string that contains all characters.</p>
  
  <p>Also, I have a problem with output</p>
  
  <pre><code>int main() {
      string name;
      string temp;
      cout &lt;&lt; "Enter your name:";
      cin &gt;&gt; name;
      cout &lt;&lt; endl;
      for(auto a:name) {
          if(isalpha(a)) {
              temp=name;
          } else {
              while(!isalpha(a)) {
                  cout &lt;&lt; "Enter your name without digit:";
                  cin &gt;&gt; name;
                  cout &lt;&lt; endl;
              }
          }
      }
      cout &lt;&lt; temp &lt;&lt; endl;
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wtXXc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wtXXc.png" alt="enter image description here"></a></p>