title: What's wrong with this C++ code? (undeclared identifier)
body: <p>Getting this error: <code>(68): error C2065: 'programend' : undeclared identifier</code></p>
  
  <p>(Off-topic note: I know that using using namespace std is bad practice, but I didn't feel like typing std:: in front of everything.  I will if that's what's causing the error, however.)</p>
  
  <p>Here's the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main(void) {
      do{
      system("title Mini-Calc");
      cout &lt;&lt; "Hello World!  Welcome to Dustin's C++ Calculator!" &lt;&lt; endl;
      cout &lt;&lt; "To get started, enter a number:" &lt;&lt; endl;
  
      int operation;
      double num1, num2, answer;
  
      cin &gt;&gt; num1;
      cout &lt;&lt; "Now enter another number:" &lt;&lt; endl;
      cin &gt;&gt; num2;
  
      cout &lt;&lt; "Please type the corrresponding number for the operation desired, and press enter." &lt;&lt; endl;
      cout &lt;&lt; "1 = +, 2 = -, 3 = x, 4 = /" &lt;&lt; endl;
  
      cin &gt;&gt; operation;
  
      switch(operation) {
          case 1:
              answer=num1+num2;
          break;
  
          case 2:
              answer=num1-num2;
          break;
  
          case 3:
              answer=num1*num2;
          break;
  
          case 4:
              answer=num1/num2;
          break;
  
      }
  
      cout &lt;&lt; "The answer is: " &lt;&lt; endl;
      cout &lt;&lt; answer &lt;&lt; endl;
  
      bool programend;
  
      cout &lt;&lt; "Would you like to end the program? (y for yes, n for no)" &lt;&lt; endl;
  
      cin &gt;&gt; programend;
  
      switch(programend) {
          case 'y':
              programend=true;
          break;
  
          case 'n':
              programend=false;
          break;
  
          case 'Y':
              programend=true;
          break;
  
          case 'N':
              programend=false;
          break;
          }
      } while (programend==false);
      return 0;
  }
  </code></pre>