title: issue with using a do while with a switch
body: <p>new to working with loops, I had an original program made to be able to chose a few classes from different CRN's and then be charged for the various credit hours the represented.</p>
  
  <p>Now Im pretty new to do while loops but I figured I could have an if else inside the do while and just keep looping it. My aim was to let the loop exit on every option chosen BESIDES the option where you were choosing above the allotted amounts of classes (in this case the max amount of classes are 3).</p>
  
  <p>It seems it does not want to loop though, is this a poor way of doing a do while loop and is there a more elegant way of approaching these?</p>
  
  <pre><code>do{
  
  printf("Please enter Student ID:\n");
  scanf("%i", &amp;studentId);
  printf("Enter how may courses-up to 3:\n");
  scanf("%f", &amp;amount);
  
  
      if(amount == 1){
          printf("Enter the course number:\n\n");
          scanf("%d", &amp;course);
          switch(course)
             {
               case 4587:
                  credit1 = 4;
                  break;
              case 4599:
                  credit2 = 3;
                  break;
              case 8997:
                  credit3 = 1;
                  break;
              case 9696:
                  credit4 = 3;
                  break;
              default:
                  printf("Sorry invalid entry!\n\n");
  
                  return 0;
            }
          a = 1;
      }
      else if(amount == 2){
          printf("Enter the 2 course numbers\n");
          scanf("%d %d", &amp;course, &amp;course1);
              switch(course)
               {
               case 4587:
                  credit1 = 4;
                  break;
              case 4599:
                  credit1 = 3;
                  break;
              case 8997:
                  credit1 = 1;
                  break;
              case 9696:
                  credit1 = 3;
                  break;
              default:
                  printf("Sorry invalid entry!\n\n");
                  return 0;
              }
            switch(course1)
              {
               case 4587:
                  credit2 = 4;
                  break;
              case 4599:
                  credit2 = 3;
                  break;
              case 8997:
                  credit2 = 1;
                  break;
              case 9696:
                  credit2 = 3;
                  break;
              default:
                  printf("Sorry invalid entry!\n\n");
                  return 0;
              }
             a = 1;
          }
  
      else if(amount == 0){
          printf("Thank you!\n\n");
          a = 1;
      }
      else if(amount &gt; 3){
          printf("Invalid number of courses (up to 3)\n");
          a = 0;
  
      }
      else{
          printf("Sorry, we cant process your request this time-invalid number of courses.\n\n");
          printf("\t\t\tTry again. Goodbye!\n");
          return 0;
      }
  
  }while(a = 0);
  </code></pre>