title: Do...While won't stop
body: <p>So I am making a program for an assignment and at the moment I am trying to get user input and trying to make it fit a certain form.</p>
  
  <p>For example the user is to type in a date with the format mm/yyyy.
  If the user does not type it in that format it will just reprompt the user.</p>
  
  <p>so far this is my small loop:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int findSlash(char[], int);
  int findLastEle(char[]);
  
  int main() {
  //variables
  char expDate[7];
  int expLast, expEle;
  int expLen;
  
  do{
  cout &lt;&lt; "Enter experation (form mm/yyyy): ";
  cin.getline(expDate, 7);
  expLen = strlen(expDate);
  expEle = findSlash(expDate, expLen);
  expLast = findLastEle(expDate);
  
  }while(expEle != (expLast - 4));
  
  return 0;
  }
  
  //findSlash function (finds slash place in array)
  int findSlash(char array[], int arrayLen){
  int r, dec = 0;
  
  for(r = 0; r &lt; arrayLen; r++){
      if(array[r] == '/'){
          break;
      }
      else{
          dec++;
      }
  }
  
  return dec;
  }
  </code></pre>
  
  <p>The loop is suppose just reprompt at the moment if '/' is not in the right spot but the loop instead just spams the cout statement and I don't know why its doing that. Any help would be appreciated :D</p>