Professional Documents
Culture Documents
ATM PROGRAM
LAB PROJECT: 01
Department: CIS
Name: Abdul Rehman
Serial Number: 02
Date of submission: 21/nov/2021
CODE:
#include<stdio.h>
#include<stdlib.h>
Int main () {
//Validity check
Int
pin,entered_pin,intial_amount,count=1,new_pin1,new_pin2,_new_pin
3,old_pin;
pin=5678;
intial_amount=250000;
printf("\t\tMUSLIM BANK\n");
printf("*WELCOME*\n");
while (entered_pin!=pin)
{
printf("\nEnter your Pin\n");
scanf("%d",&entered_pin);
if (entered_pin!=pin && count!=3)
printf("\nInvalid try again!\n");
if (count==3 && entered_pin!=pin )
{
printf("Your card is captured. Please contact the Bank
Manager");
exit(0);
}
count++;
}
//validity check over;
//MAIN MENU
int
ext=0,opt,amount,amount2=25000,ext2=0,amount3,amount4=90000,e
xt3=0,ext4=0,ext5=0;
char s,opt2;
while (ext!=1)
{
printf("\t\tPlease select the option\n");
printf("1) Balance Enquiry\n2) Cash Withdrawal\n3) Cash
Deposit\n4) Change PIN\n5) Exit\n");
scanf("%d",&opt);
switch(opt)
{
//balance enquiry
case 1:
printf("Your current balance is %d\n",intial_amount);
printf("Press A to return to main menu or enter B to
Exit\n");
scanf("%s",&s);
if (s=='A')
continue;
else if(s=='B')
ext=1;
// cash withdraw
case 2:
while (ext2!=2){
}
}
break;
}
printf("Press A to return to main menu or enter B to
Exit\n");
scanf("%s",&s);
if (s=='A')
continue;
else if(s=='B')
ext=1;
//Exit
case 5:
printf("Thanks, Allah Hafiz, Please Take Your
Card");
exit(0);
}
}
getchar();
return 0;
}
OUTPUT for Pin Validity:
Case 1: When all Tries are fail!
Case 2:
Pin correctly entered after 2 tries and main menu is shown:
OUTPUT for balance enquiry + Repeat option;
OUTPUT for cash withdrawal:
OUTPUT for Cash deposit;
OUTPUT for Pin Change;