title: Switch Statement Only Defaults c++
body: <p>So I'm writing some code and I have this switch statement to set some bools in a 2d array. I have a nested for loop and a switch with switches in the nested loop setting on outer loop <code>int i</code> and inner loop <code>int e</code>. <code>grammar[i][e]</code> I'm switching on i and then on e but for some reason it just defaults on me. I have it printing out i and e.. and it still just defaults so there must be something wrong with my switch statements but I'm not seeing the issue here.</p>
  <pre><code>bool follows = false;
  for (int i = 0; i &lt; 12; i++)
  {
      // 1 noun, 2 pronoun, 3 verb, 4 adverb, 5 adjective, 6 preposition, 7 conjunction, 8 determiner, 9 interjection, 10 exclamation, 11 notype, 12 auxiliary
      for (int e = 0; e &lt; 12; e++)
      {
          //std::cout &lt;&lt; &quot; This is where we're at in grammar array &quot; + std::to_string(i) + &quot; and &quot; + std::to_string(e);
          switch (i)
          {
              case 0: // noun // noun
                  switch (e) {
                      case 0: // noun
                          follows = false;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = true;
                          break;
                      case 3: // adverb
                          follows = true;
                          break;
                      case 4: // adjective
                          follows = true;
                          break;
                      case 5: // preposition
                          follows = false;
                          break;
                      case 6: // conjunction
                          follows = true;
                          break;
                      case 7: // determiner
                          follows = true;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 1: // pronoun //pronoun
                  switch (e) {
                      case 0: // noun
                          follows = false;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = true;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = true;
                          break;
                      case 5: // preposition
                          follows = true;
                          break;
                      case 6: // conjunction
                          follows = true;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 2: // verb // verb
                  switch (e) {
                      case 0: // noun
                          follows = true;
                          break;
                      case 1: // pronoun
                          follows = true;
                          break;
                      case 2: // verb
                          follows = false;
                          break;
                      case 3: // adverb
                          follows = true;
                          break;
                      case 4: // adjective
                          follows = false;
                          break;
                      case 5: // preposition
                          follows = false;
                          break;
                      case 6: // conjunction
                          follows = false;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 3: // adverb //adverb
                  switch (e) {
                      case 0: // noun
                          follows = false;
                          break;
                      case 1: // pronoun
                          follows = true;
                          break;
                      case 2: // verb
                          follows = true;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = true;
                          break;
                      case 5: // preposition
                          follows = false;
                          break;
                      case 6: // conjunction
                          follows = true;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 4: // adjective //adjective
                  switch (e) {
                      case 0: // noun
                          follows = false;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = true;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = false;
                          break;
                      case 5: // preposition
                          follows = false;
                          break;
                      case 6: // conjunction
                          follows = true;
                          break;
                      case 7: // determiner
                          follows = true;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 5: // preposition //preposition
                  switch (e) {
                      case 0: // noun
                          follows = true;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = true;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = false;
                          break;
                      case 5: // preposition
                          follows = false;
                          break;
                      case 6: // conjunction
                          follows = true;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 6: // conjunction //conjunction
                  switch (e) {
                      case 0: // noun
                          follows = true;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = true;
                          break;
                      case 3: // adverb
                          follows = true;
                          break;
                      case 4: // adjective
                          follows = true;
                          break;
                      case 5: // preposition
                          follows = true; // change
                          break;
                      case 6: // conjunction
                          follows = false;
                          break;
                      case 7: // determiner
                          follows = false; // change
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 7: // determiner //determiner
                  switch (e) {
                      case 0: // noun
                          follows = true;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = true;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = false;
                          break;
                      case 5: // preposition
                          follows = true;
                          break;
                      case 6: // conjunction
                          follows = false;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 8: // interjection //interjection
                  switch (e) {
                      case 0: // noun
                          follows = true;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = false;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = false;
                          break;
                      case 5: // preposition
                          follows = true;
                          break;
                      case 6: // conjunction
                          follows = false;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 9: // exclamation //exclamation
                  switch (e) {
                      case 0: // noun
                          follows = true;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = false;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = false;
                          break;
                      case 5: // preposition
                          follows = true;
                          break;
                      case 6: // conjunction
                          follows = false;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 10: //NoType //NoType
                  switch (e) {
                      case 0: // noun
                          follows = true;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = false;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = false;
                          break;
                      case 5: // preposition
                          follows = true;
                          break;
                      case 6: // conjunction
                          follows = false;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = true;
                          break;
                      default:
                          break;
                  }
              case 11: //auxiliary
                  switch (e) {
                      case 0: // noun
                          follows = true;
                          break;
                      case 1: // pronoun
                          follows = false;
                          break;
                      case 2: // verb
                          follows = false;
                          break;
                      case 3: // adverb
                          follows = false;
                          break;
                      case 4: // adjective
                          follows = false;
                          break;
                      case 5: // preposition
                          follows = true;
                          break;
                      case 6: // conjunction
                          follows = false;
                          break;
                      case 7: // determiner
                          follows = false;
                          break;
                      case 8: // interjection
                          follows = true;
                          break;
                      case 9: // exclamation
                          follows = true;
                          break;
                      case 10: //NoType
                          follows = true;
                          break;
                      case 11: // auxiliary
                          follows = false;
                          break;
                      default:
                          break;
                  }
              default:
                  // TODO CHANGE THIS 
                  std::cout &lt;&lt; &quot;Defaulting for some reason.&quot; + std::to_string(i) + &quot; on i &quot;;
                  follows = true;
                  break;
          }
          grammar[i][e] = follows;
          if (grammar[i][e]) { std::cout &lt;&lt; std::to_string(i) + std::to_string(e) + &quot; True &quot;; }
          else { std::cout &lt;&lt; std::to_string(i) + std::to_string(e) + &quot; False &quot;; }
      }
  }
  
  </code></pre>