title: Do while loop won't break?
body: <p>I'm working on this as a function for a class project, but I can't figure out why the loop won't break when the user enters &quot;N&quot;. It just keeps looping no matter what the user enters when asked if they want to continue.</p>
  <p>Can someone help me get the loop to break properly? That's the only part of the code that isn't working.</p>
  <pre><code>
  #include&lt;iostream&gt;
  #include&lt;fstream&gt;
  #include&lt;string&gt;
  
  using namespace std;
  
  const string ADDRESS_FILE_NAME = &quot;Address.csv&quot;;   
  
  int main()
  {
      string name;
      string street;
      string city;
      string state;
      string zip;
      char input;
      //TODO: Declare variables for name and address fields
      
      ofstream inputAddress(ADDRESS_FILE_NAME);
      
      //TODO: Open address file for output using ofstream()
      
      do{
      cout &lt;&lt; &quot;Enter name: &quot; &lt;&lt; endl;
          getline(cin, name);
          cin.ignore();
      cout &lt;&lt; &quot;Enter street name: &quot; &lt;&lt; endl;
          getline(cin, street);
          cin.ignore();
      cout &lt;&lt; &quot;Enter city: &quot; &lt;&lt; endl;
          getline(cin, city);
          cin.ignore();
      cout &lt;&lt; &quot;Enter state: &quot; &lt;&lt; endl;
          getline(cin, state);
          cin.ignore();
      cout &lt;&lt; &quot;Enter zip code: &quot; &lt;&lt; endl;
          getline(cin, zip);
          cin.ignore();
      cout &lt;&lt; &quot;Enter another address? (Y/N)&quot; &lt;&lt; endl;
          cin &gt;&gt; input;
          cin.ignore();
      }while(input != 'N' &amp;&amp; 'n');
      return 0;
      
      
      //TODO: Loop to accept and write addresses 
      //    Prompt user to enter name and address fields
      //    Write entered data to address file separated by commas
      //    Ask user if more addresses to enter
      //    Repeat loop while user responds 'Y' or 'y'
      
      inputAddress.close();
      //TODO: Close address file
  
  }
  </code></pre>