title: ATM Machine in C
body: <p>I've been writing the code for an ATM inter face where i include a pin that must be imputed by the user to access the options. Once thats done, I get 5 options to choose from such as fast cash, withdraw, deposit and check balance. everything seems to be running good the only thing is that the account balance is not be updated to the correct amount when the user deposits, withdraws, or gets fast cash. Can someone help me fix this. I'll post my code down below</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int fastCash(int amount);
  int deposit(int deposit);
  int withdraw(int balence);
  void checkBalence(int balence);
  
  int main()
  {
      int pin;
      int pins = 9999;
      int pinTries = 1;
      int reciept;
      int options;
      int options2;
      int balence = 300;
      int fastCashChoice;
      printf("Enter your pin:");// the pin is 9999
      scanf("%d", &amp;pin);
      while (pinTries &lt;= 3)
      {
          if (pin == pins)
          {
              printf("Would you like a reciept:");
              //1 is equal to yes and 2 is equal to no
              scanf("%d", &amp;reciept);
              printf("Choose from the following:\n");
              printf("1. Fast cash\n2. Withdraw\n3. Deposit\n4. Check balence\n5. Get card back");
              scanf("%d", &amp;options);
              while (options &lt;= 5)
              {
                  switch (options)
                  {
                  case 1:
                      fastCash(fastCashChoice);
                      balence = balence - fastCashChoice;
                      break;
  
                  case 2:
                      withdraw(balence);
                      break;
  
                  case 3:
                      deposit(balence);
                      break;
  
                  case 4:
                      checkBalence(balence);
                      break;
  
                  case 5:
                      options2 == 2;
                      break;
  
                  }
                  printf("Would you like anohter transaction: ");// 1 is equal to yes and 2 is equal to no
                  scanf("%d", &amp;options2);
                  if (options2 == 1)
                  {
                      printf("1. Fast cash\n2. Withdraw\n3. Deposit\n4. Check balence\n5. Get card back");
                      scanf("%d", &amp;options);
                  }
  
                  else
                  {
                      options = 5;
                      pinTries = 4;
                      printf("Thank you for useing this ATM, GoodBye\n");
                  }
              }
          }
  
          else if (pin != pins)
          {
              printf("Invalid pin, try again:");
              scanf("%d", &amp;pin);
              pinTries++;
          }
  
          if (pinTries == 3)
          {
              printf("Sorry, you cant continue, please contact your bank");
          }
      }
      return 0;
  }
  
  
  int fastCash(int amount)
  {
      int choice;
      printf("1. $20.00\n2. 40.00\n3. 80.00\n4. 100.00\n5. Exit");
      scanf("%d", &amp;choice);
  
      switch (choice)
      {
      case 1:
          amount = 20;
  
      case 2:
          amount = 40;
  
      case 3:
          amount = 80;
  
      case 4:
          amount = 100;
  
      case 5:
          break;
      }
  
      return amount;
  }
  
  int withdraw(int balence)
  {
      int withdrawAmount;
      printf("Enter the amount you would like to withdraw: ");
      scanf("%d", &amp;withdrawAmount);
      balence = -withdrawAmount;
      return balence;
  }
  
  int deposit(int balence)
  {
      int depositAmount;
      printf("Enter an amount you would like to deposit: ");
      scanf("%d", &amp;depositAmount);
      balence += depositAmount;
      return balence;
  }
  
  void checkBalence(int balence)
  {
      printf("Your current balence is: %d\n", balence);
      return;
  }
  </code></pre>