title: C++ cannot figure out how to jump into the switch from user input
body: <p>ok so i am writing a console application that uses a switch to display products and prices. however i am having hell figuring out how to make it jump into the switch when the user inputs the product number </p>
  
  <p>this is the code:</p>
  
  <pre><code>using namespace std;
  
  int main()
  {
  int productNum = 0;  
  int quantityArray[5];
  for (int i = 0; i &lt; 5; ++i)
  quantityArray[i] = 0;
  char answer = ('y' || 'n' || 'e' || 'Y' || 'N' || 'E');
  double priceArray[5] = { 2.98, 4.50, 9.98, 4.99, 6.87 };
  double total1 = (quantityArray[0] * priceArray[0]);
  double total2 = (quantityArray[1] * priceArray[1]);
  double total3 = (quantityArray[2] * priceArray[2]);
  double total4 = (quantityArray[3] * priceArray[3]);
  double total5 = (quantityArray[4] * priceArray[4]);
  double checkout = total1 + total2 + total3 + total4 + total5;
  
  cout &lt;&lt; "Please select a product number 1, 2, 3, 4, or 5" &lt;&lt; endl;
  cin &gt;&gt; productNum;
  do
      {
  
         switch (productNum)
         {
         case '1':
             cout &lt;&lt; "1 inch x 1 inch sticker is $" &lt;&lt; priceArray[0] &lt;&lt; endl;
         cout &lt;&lt; "How many of these stickers would you like to purchase?" &lt;&lt; endl;
          cin &gt;&gt; quantityArray[0];
                cout &lt;&lt; "You have selected " &lt;&lt; quantityArray[0] &lt;&lt; "at the price of $" &lt;&lt; priceArray[0] &lt;&lt; endl;
                cout &lt;&lt; "Is this correct?" &lt;&lt; endl;
                cout &lt;&lt; "Y for yes, N for no, E to checkout." &lt;&lt; endl;
                cin &gt;&gt; answer;
         case '2':
                cout &lt;&lt; "3 inch x 2 inch sticker is $" &lt;&lt; priceArray[1] &lt;&lt; endl;
                cout &lt;&lt; "How many of these stickers would you like to purchase?" &lt;&lt; endl;
                cin &gt;&gt; quantityArray[1];
                cout &lt;&lt; "You have selected " &lt;&lt; quantityArray[1] &lt;&lt; "at the price of $" &lt;&lt; priceArray[1] &lt;&lt; endl;
                cout &lt;&lt; "Is this correct?" &lt;&lt; endl;
                cout &lt;&lt; "Y for yes, N for no, E to checkout." &lt;&lt; endl;
                cin &gt;&gt; answer;
         case '3':
                cout &lt;&lt; "7 inch x 7 inch sticker is $" &lt;&lt; priceArray[2] &lt;&lt; endl;
                cout &lt;&lt; "How many of these stickers would you like to purchase?" &lt;&lt; endl;
                cin &gt;&gt; quantityArray[2];
                cout &lt;&lt; "You have selected " &lt;&lt; quantityArray[2] &lt;&lt; "at the price of $" &lt;&lt; priceArray[2] &lt;&lt; endl;
                cout &lt;&lt; "Is this correct?" &lt;&lt; endl;
                cout &lt;&lt; "Y for yes, N for no, E to checkout." &lt;&lt; endl;
                cin &gt;&gt; answer;
         case '4':
                cout &lt;&lt; "3 inch x 3 inch sticker is our current special at $" &lt;&lt; priceArray[3] &lt;&lt; endl;
                cout &lt;&lt; "How many of these stickers would you like to purchase?" &lt;&lt; endl;
                cin &gt;&gt; quantityArray[3];
                cout &lt;&lt; "You have selected " &lt;&lt; quantityArray[3] &lt;&lt; "at the price of $" &lt;&lt; priceArray[3] &lt;&lt; endl;
                cout &lt;&lt; "Is this correct?" &lt;&lt; endl;
                cout &lt;&lt; "Y for yes, N for no, E to checkout." &lt;&lt; endl;
                cin &gt;&gt; answer;
         case '5':
                cout &lt;&lt; "5 inch x 4 inch sticker is $" &lt;&lt; priceArray[4] &lt;&lt; endl;
                cout &lt;&lt; "How many of these stickers would you like to purchase?" &lt;&lt; endl;
                cin &gt;&gt; quantityArray[4];
                cout &lt;&lt; "You have selected " &lt;&lt; quantityArray[4] &lt;&lt; "at the price of $" &lt;&lt; priceArray[4] &lt;&lt; endl;
                cout &lt;&lt; "Is this correct?" &lt;&lt; endl;
                cout &lt;&lt; "Y for yes, N for no, E to checkout." &lt;&lt; endl;
                cin &gt;&gt; answer;
                  if (answer = 'y' || 'Y')
                  {
                      break;
                  }
                  else if (answer = 'n' || 'N')
                  {
                      cout &lt;&lt; "Please select a qantity." &lt;&lt; endl;
                  }
                  else if (answer = 'e' || 'E')
                  {
                      cout &lt;&lt; checkout &lt;&lt; endl;
                  }
         }
      }while (answer != 'e' || 'E');
  </code></pre>
  
  <p>}</p>
  
  <p>my book uses a header file to show how to initialize a swtich but it uses multiple methods. I am pretty sure that I can get this into one method without using a header.</p>