title: while(true) switch case -- Is it possible to achieve variable case matches eg: using a for loop?
body: <p>I was just wondering if it was possible to have a variable case using the keyboard? So the cases can be any choice from a to z and its completely variable eg: only choices a),b) and c) appear in one condition bur in another a),b),c),d) and e) might appear. Assume they all call the same function but input a different argument.</p>
  
  <pre><code>    char choice;
  int i;
  while(true)
  {
              // This increments from char 'a' onward to 'b', 'c', 'd', etc.
      for (i = 0; i &lt; number; i++){
              char character = 'a';
              cout &lt;&lt; static_cast&lt;char&gt;(character + i) &lt;&lt; ") list of choices" &lt;&lt; endl;
      }
  
      cin &gt;&gt; choice;
  
      switch(choice) {
  
                      // Same incremental principal to achieve variable cases
          for (i = 0; i &lt; number; i++){
                  char character = 'a';
                  character = (static_cast&lt;char&gt;(character + i) );
  
          case character: carryOutJob(argumentDependantOnCharacter);
          }
              }
      }
  </code></pre>
  
  <p>If I run code similar to this I get errors that look a little something like this:</p>
  
  <pre><code>: error: ‘character’ cannot appear in a constant-expression
  : error: jump to case label [-fpermissive]
  : error:   crosses initialization of ‘char character’
  : error: expected ‘;’ before ‘}’ token
   Error 1
  </code></pre>