Bank Atm project using C Programming
#include<stdio.h>
#include<stdlib.h>
void deposite();
void withdrawl();
void balancecheck();
void transfer();
int tac=5000,inac,tamt;
int *rtac;
float mb=20000;
int depo;
int wdrawl;
char ch;
int main()
{
printf("$*****----Welcome to our bank----*****$\n");
int choice;
up:
up1:
printf("Press 1 for deposite\n");
printf("Press 2 for withdrawl\n");
printf("Press 3 for balance check\n");
printf("Press 4 for balance transfer\n");
printf("Press 5 for log out\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
deposite();
up2:
printf("\nPress y for continue\nPress n for exit");
ch=getch();
system("cls");
if(ch=='y' || ch=='Y')
{
goto up1;
}
else if(ch=='n' ||ch=='N')
{
printf("Thank you\n\n");
exit(0);
}
else
{
printf("Press y for continue & n for exit");
goto up2;
}
break;
case 2:
withdrawl();
up3:
printf("\nPress y for continue\nPress n for exit");
ch=getch();
system("cls");
if(ch=='y' || ch=='Y')
{
goto up1;
}
else if(ch=='n' ||ch=='N')
{
printf("Thank you\n\n");
exit(0);
}
else
{
printf("Press y for continue & n for exit");
goto up3;
}
break;
case 3:
balancecheck();
up4:
printf("\nPress y for continue\nPress n for exit");
ch=getch();
system("cls");
if(ch=='y' || ch=='Y')
{
goto up1;
}
else if(ch=='n' ||ch=='N')
{
printf("Thank you\n\n");
exit(0);
}
else
{
printf("Press y for continue & n for exit");
goto up4;
}
break;
case 4:
//transfer();
printf("transfer address=%u\n",&tac);
printf("enter account no to transfer amount:\n");
scanf("%u",&rtac);
if(rtac==&tac)
{
printf("enter transfer amount\n");
scanf("%d",&tamt);
transfer(tamt);
}
else
{
printf("give a correct ac no:\n");
}
break;
case 5:
return 0;
default:
printf("Enter between 1,2,3,4 or 5");
}
goto up;
}
void deposite()
{
system("cls");
up1:
printf("Enter amount to deposite:");
scanf("%d",&depo);
if(depo<=500)
{
printf("Deposite more than 500:\n");
}
else
{
printf("Privious balance is=%.2f\n",mb);
printf("Your deposite amount is=%d\n",depo);
mb=mb+depo;
printf("Your current balance is%.2f\n",mb);
}
// getch();
// system("cls");
printf("Thank you\n\n");
}
void withdrawl()
{
system("cls");
printf("Enter amount to withdreawl:");
scanf("%d",&wdrawl);
printf("collect your cash\n");
mb=mb-wdrawl;
printf("Your current balance is%.2f\n",mb);
}
void transfer()
{
system("cls");
int amt;
if(mb>amt)
{
printf("your previous balance is:%.2f\n",mb);
mb=mb-amt;
printf("your current balance is:%.2f\n",mb);
*rtac=*rtac+amt;
printf("your ac is debited with %d\n",amt);
printf("your transfer %d amount\ntransfer ac no is=%u\n",amt,rtac);
printf("transfer account=%d\n",tac);
}
}
void balancecheck()
{
system("cls");
printf("Your current balance is%.2f\n",mb);
}
Comments
Post a Comment