ATM machine project in C language with source code


Hello there, In this article, you will find the source code for ATM Transaction Machine for C Language.
I hope this will help you, if yes please let me know in the comment section.




Source Code:



// Program for ATM Project

    
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
 clrscr();
 int pin,count=0,neu,old,bal=1000,deposite,change,choice,amount;
 char transaction,quit,enter;
 printf("\n\n\n\n\n\t\t\t\t  WELCOME TO\n\n");
 printf("\t\t\t   ORIENTAL BANK OF COMMERCE\n");
 textcolor(WHITE+BLINK);
 printf("\n\n\n\n\n\n\n\nPress ");
 cprintf("Enter ");
 printf("to Continue...\t\t\t Created By: Rakshit Shrivastava");
 scanf("%c",&enter);
 if(enter==10)
 {
  system("cls");
 }
 pin:
 printf("Enter PIN number : ");
 scanf("%d",&pin);
 if(pin==1234)
 {
   system("cls");
   printf("\t\t\t   Welcome to OBC ATM Service\n");
   start:
   printf("\n(1) Check Balance\n");
   printf("(2) Withdrawl\n");
   printf("(3) Deposite Cash\n");
   printf("(4) Change PIN\n");
   printf("(5) Quiet\n");
   printf("\n");
   printf("Enter your choice : ");
   scanf("%d",&choice);
   switch(choice)
   {
   	case 1:printf("Current Balance : %d\n",bal);
       	   goto end;

    case 2:printf("Enter the amount you want to withdraw : ");
           scanf("%d",&amount);
           if(amount>0&&amount<=bal)
            {
              bal=bal-amount;
              printf("Amount Credited %d\n",amount);
              printf("Remaining Amount %d\n",bal);
           	}
           else
              printf("Invalid Amount\n");
              goto end;

  	 case 3:printf("Enter the amount you want to deposite : ");
           	 scanf("%d",&deposite);
             if(deposite>0)
              {
                bal=bal+deposite;
                printf("Your new balance is %d\n",bal);
              }
             else
                printf("Invalid Amount\n");
                goto end;

  	  case 4:printf("Enter your current PIN : ");
             scanf("%d",&old);
             if(old==pin)
             {
                printf("Enter your new pin : ");
                scanf("%d",&neu);
                pin=neu;
                printf("You have successfully changed you PIN\n");
             }
             else
                printf("Invalid PIN\n");
                goto end;

       case 5:printf("Are you sure, you want to quit ? (y/n): ");
              scanf("%c",&quit);
              quit=getchar();
              if(quit=='y')
              {
                 printf("Thankyou for using our services.\n");
                 break;
              }
              else
              {
               goto start;
              }
 	 default:system("cls");
             printf("Invalid Choice\n");
           	 goto pin;
       }
  }
  else
  {
     printf("Invalid PIN number\n");
     count++;
  	 if(count==3)
   	  {
   		 printf("Your card blocked\n");
      }
  	   else
        goto pin;
      goto exit;
      end:
      printf("Do you wish to have another transaction (y/n) : ");
      scanf("%c",&transaction);
      transaction=getchar();
      if(transaction=='y')
  		{
   			goto start;
  		}
  		else
   			printf("Thankyou for using our services");
   		}
		 exit:
		 getch();
}    

    
Thank you.

Post a Comment

0 Comments