title: C++ Compiler Seemingly Skipping Line of Code
body: <p>I am new to C++ programming and am obviously missing something. In the following code the compiler doesn't seem to recognize this line: <code>lengths[counter] = findDups(crtLine);</code> I get an error: variable "lengths" set but not used. I cannot figure out why it is not recognizing this line, when the <code>names[counter] = getNameOnly(crtLine)</code> works perfectly and it is essentially the same format. Any insight into this issue is appreciated!</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;algorithm&gt;
  
  using namespace std;
  
  
  string getNameOnly (string line) {
      return line.substr(0, line.find(' '));
  }
  
  int findDups (string line) {
      string lnCpy = line;
      sort(lnCpy.begin(), lnCpy.end());   
      int i = 0; 
      int dups = 0;
      int j = 1;
      int len = lnCpy.length();
      while (j &lt; len) {
          if (lnCpy.at(i) == lnCpy.at(j))
                  dups++;
          i++;
          j++;
      }
  
      if (dups != 0)
          return 0;
      else
              return lnCpy.length();
  }
  
  int main() {
  
  string names[1219];
  int lengths[1219];
  string crtLine;
  int counter = 0;
  
  ifstream myfile ("dist.male.first");
  if (myfile.is_open()) {
      while (!myfile.eof()) {
          getline(myfile,crtLine);
          lengths[counter] = findDups(crtLine);           
          names[counter] = getNameOnly(crtLine);                  
          counter++;
      }
      myfile.close();
  }   
  else cout &lt;&lt; "Unable to open file";
  
  
  return (0);
  </code></pre>
  
  <p>}</p>