title: C++ user input restriction with proper retry without "goto"
body: <p>I have the following code:</p>
  
  <pre><code>qstn:
    cout &lt;&lt; "Input customer's lastname: ";
    getline(cin, lname);
  
    if (lname.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ") != string::npos) {
        cout &lt;&lt; "You can only input alpha here!\n";
        cin.clear();
        goto qstn;
    } else if (lname.empty()) {
        cout &lt;&lt; "Please enter your firstname!\n";
        cin.clear();
        goto qstn;
    }
  
    int lnamel = lname.length();
    int strl = str.length();
    int is = 0;
  
    for (int i = 1; i &lt; strl;) {
        i++;
        is++;
  
        if (lname[i] == lname[is] &amp;&amp; lname[i] == ' ' || lname[0] == ' ') {
            cin.clear();
            cout &lt;&lt; "Please input your lastname properly!\n";
            goto qstn;
        }
    }
    // next question here
  </code></pre>
  
  <p>I'm having a hard time on thinking what will be the proper logic to avoid the
  goto statement, since I was college I was using it but someone here said that
  it's not good to use it at all cause it might ruin my code. </p>
  
  <p>I tried using the do while loop but it's not smooth as goto. </p>
  
  <p>Please help!</p>