title: c program to allow user to change there already set 4 digit pin
body: <ol>
  <li>Enter PIN and verify correct</li>
  <li>Change PIN</li>
  <li>Display the number of times the PIN was entered (i) Successfully (ii) 
  Incorrectly</li>
  <li>Exit Program</li>
  </ol>
  
  <p>I am having problems option 2 in the question above it is supposed to do the following:
  If they select option 2, they should be allowed to change their PIN. the program should verify the original pin first. When they enter the new PIN, your program must verify the new PIN by asking the 
  customer to re-enter this new PIN. This will verify that the new PIN entered 
  is correct and no errors were made. If there are any differences and the 
  verification fails, your program must display an appropriate error message 
  and the original PIN should remain the same.</p>
  
  <p>My problem arises when the user is entering their new pin, 1. the pin must be 4 digits long 2. If the user enters a pin wrong when entering a new pin, the original pin must remain the same. If they enter their new pin right then their new pin must change to that pin. I have posted the code i have so far for option 2. </p>
  
  <p>If my question is not clear please ask me questions.</p>
  
  <pre><code>case 2:
        {
             //ask user to enter their current pin
             printf("Please enter your current pin \n");
             scanf("%d",&amp;current_pin);
  
  
             if(current_pin != 1234)
             {
                  //if pin entered is not the same as 1234-print error
                  printf("Incorrect pin \n");
                  unsuccessful ++;
                  break;
             }//end if    
  
             else
              {
                  successful++; 
  
                  //ask user to enter new pin
                  printf("Please enter your new pin: \n");
                  scanf("%d",&amp;new_pin);           
  
              } //end else
  
              //set new pin as the current pin
              current_pin = new_pin:      
  
              //check if pin is 4 digits long
              if(current_pin&gt;999 &amp;&amp; current_pin&lt;10000)
              {
                  //ask user to re enter their new pin
                  printf("Please re-enter your new pin: \n");
                  scanf("%d",&amp;new_pin);
  
                  printf("Your new pin is %d", new_pin);
  
                  //set new pin as the current pin
                  current_pin = new_pin:  
              }   
  
             else
              {
                  printf("Incorrect entry- pin must be 4 digits and cannot start with a 0");                          
              }
  
                     new_pin=current_pin;
  
                break;
              }
  </code></pre>
  
  <p>I know this code is very sloopy i hope you can make sense of it. I know what i am trying to do but i can't do it.</p>
  
  <p>****EDIT****
  Ok i now understand that i have made some of you confused.  Maybe i should reword my question. And break it down into sections. And if it is easier i can post the full code for the program.</p>
  
  <ol>
  <li><p>I want the user to enter their current pin which if the program is running for the first time has been assigned the value 1234. If the user has already gone through the process the current pin will now be the pin they have changed it to.</p></li>
  <li><p>The pin new pin must be 4 digits </p></li>
  <li><p>This might be pushing it but if the user enters a letter into my program it will go into an infinite loop, is there a simple way around this. </p></li>
  </ol>