title: 2nd Scanf in loop is not being read.jumps to else condition
body: <pre><code>#include "stdafx.h"
  #include "windows.h"
  
  
  #define A_P 4.55
  
  double pounds;
  double subT = 0.0;
  double totalP = 0.0;
  double totalSub = 0.0;
  
  void main()
  {
  char item;
  
      while (1) {
          printf("Please select your item.\n");
          scanf("%c", &amp;item);
          if (item == 'a') {
              price = A_P;
              printf("Please enter the amount in pounds.(lb)");
              scanf("%f", &amp;pounds);
              if (pounds &gt; 0) {
                  subT = price * pounds;
                  totalP += pounds;
                  totalSub += subT;
              }
              else {
                  printf("1st");
              }
          }
          else {
              printf("2nd");
          }
  
      }
  </code></pre>
  
  <p>I don't understand why i am getting this logical error. When the user enters an item, i ask the user for another input which is the "pounds" of the item. But i have no idea why it goes to the last else condition which prints out "2nd". Can anyone explain what is happening. I initially tried this with a switch as well but the same problem occurs.</p>
  
  <pre><code>case 'A':
          case 'a':
              price = A_P;
              printf("Please enter the amount in pounds.(lb)");
              scanf("%f", &amp;pounds);
              if (pounds &gt; 0) {
                  subT = price * pounds;
                  totalP += pounds;
                  totalSub += subT;
              }
              else
                  Beep(500, 500);
              break;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>default:// goes straight to the defualt statement ignores second scanf which reads pounds varaible
              printf("That is an invlalid input.\n");
              Beep(500, 1000);
  </code></pre>