ATM prog

This is a discussion on ATM prog within the C Programming forums, part of the General Programming Boards category; please help me on my project. i want my program to print this message "your account is closed .........etc" once ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    3

    ATM prog

    please help me on my project. i want my program to print this message "your account is closed .........etc" once i entered PIN three times incorrectly

    so far this is my program

    Code:
    
    
    
    #include<stdio.h>
    #include<conio.h>
    #include<dos.h>
    main()
    {
    	textcolor(9);
    	int  account,balance,savbalance,curbalance,transaction;
    	int  amount,savings,current;
    	int  pin,c,a;
    	char x;
    	clrscr();
    	gotoxy(35,15);
    	printf("BeoBank\n");
    	delay(10);
    	gotoxy(25,17);
    	printf("Pro-Earth Banking Technology\n");
    	delay(100);
    	clrscr();
    	delay(10);
    	gotoxy(30,23);
    	printf("Insert Your Card");
    	delay(100);
    	clrscr();
    	a:
    	gotoxy(30,23);
    	printf(" ENTER PIN");
    	gotoxy(34,24);
    	printf("****");
    	gotoxy(34,24);
    	scanf("%d",&pin);
           if(pin==1001)
           {savbalance=11000;
    	curbalance=11000;}
           if(pin==1002)
           {savbalance=12000;
    	curbalance=12000;}
           if(pin==1003)
           {savbalance=13000;
    	curbalance=13000; }
           if(pin==1004)
           {savbalance=14000;
           curbalance=14000;}
           if(pin==1005)
           {savbalance=15000;
           curbalance=15000;}
           if(pin==1006)
           {savbalance=16000;
           curbalance=16000;}
           if(pin==1007)
           {savbalance=17000;
           curbalance=17000;}
           if(pin==1008)
           {savbalance=18000;
           curbalance=18000; }
           if(pin==1009)
           {savbalance=19000;
           curbalance=19000;}
           if(pin==1010)
           {savbalance=20000;
           curbalance=20000;}
           if(pin==1011)
           {savbalance=21000;
           curbalance=21000;}
           if((pin>=1012)||(pin<=1000))
           {delay(1);
           clrscr();
           gotoxy(31,24);
           printf("WRONG PIN");
           delay(1000);
           clrscr();
           goto a;
           clrscr();
           gotoxy(34,24);}
           delay(100);
           clrscr();
    	delay(100);
    	printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\tPROCESSING YOUR ACCOUNT\n");
    	printf("\n\n\n\n\t\t\t\please wait for several seconds");
    	delay(2000);
    		clrscr();
    		char more='y';
    		while(more=='y'||more=='Y')
    		{
    		gotoxy(28,10);
    		printf("TRANSACTION\n\n");
    		gotoxy(28,14);
    		printf("[1]INQUIRY");
    		gotoxy(28,18);
    		printf("[2]WITHDRAW");
    		gotoxy(28,22);
    		printf("[3]DEPOSIT");
    		gotoxy(28,26);
    		printf("[4]EXIT");
    		gotoxy(24,30);
    		printf(" Select Transaction? : ");
    		scanf("%d",&transaction);
    		clrscr();
    		switch(transaction)
           {case 1:
    		gotoxy(31,10);
    		printf("INQUIRY");
    		gotoxy(30,15);
    		printf("[1]SAVINGS");
    		gotoxy(30,18);
    		printf("[2]CURRENT");
    		gotoxy(29,22);
    		printf("Select Account:");
    		scanf("%d",&account);
    		delay(100);
    		clrscr();
    		switch(account)
    		{case 1:
    		gotoxy(34,5);
    		printf("INQUIRY");
    		gotoxy(30,10);
    		printf("SAVINGS ACCOUNT\n\n");
    		gotoxy(30,14);
    		printf("BALANCE:Php ");
    		printf("%d",savbalance);
    		break;
           case 2:
    		gotoxy(34,5);
    		printf("INQUIRY");
    		gotoxy(30,10);
    		printf("CURRENT ACCOUNT");
    		gotoxy(30,14);
    		printf("BALANCE:Php ");
    		printf("%d",curbalance);
    		break;
    		default:
    		gotoxy(36,10);
    		printf(" SORRY !!!");
    		gotoxy(20,12);
    		printf(" We cannot process your desired account");
    		gotoxy(21,14);
    		printf("you might have entered the wrong choice ");
    		break;}
    		break;
    	case 2: /*main menu*/
    		gotoxy(31,10);
    		printf("WITHDRAW\n\n\n");
    		gotoxy(30,15);
    		printf("[1]SAVINGS");
    		gotoxy(30,18);
    		printf("[2]CURRENT");
    		gotoxy(29,22);
    		printf("select account:");
    		scanf("%d",&account);
    		delay(100);
    		clrscr();
    		switch(account)
    		{case 1:
    		gotoxy( 32,5);
    		printf("WITHDRAW");
    		gotoxy(28,9);
    		printf("SAVINGS ACCOUNT");
    		gotoxy(28,10);
    		printf("Enter Amount:");
    	       scanf("%d",&amount);
    		c=amount%100;
    	       if(amount>5000)
    	       {printf("\n\n\n\t\t\SORRY !!! You have entered an invalid Amount\n");
    printf("\n\t\tYou can only withdraw an amount less than or equal to 5000"); }
    		else if((c>0)||(c!=0))
    {printf("\n\n\t\t Sorry !!! You have entered an invalid Amount");
    printf("\n\n\t\tYou can only withdraw an amount multiples of 100");}
    		else if(amount>savbalance)
    {printf("\n\n\n\n\tSorry !!! You do not have enough balance in your Account");
    printf("\n\n\t\tPlease inquire for your balance first before withdrawing");}
    	       else
    	       {gotoxy(28,13);
    	       delay(1000);
    		printf("Balance:");
    		printf("%d",savbalance);
    		gotoxy(28,16);
    		delay(1000);
    		printf("Amount Withdrawn:");
    		printf("%d",amount);
    		savbalance=savbalance-amount;
    		gotoxy(28,19);
    		delay(1000);
    		printf("Total Balance:");
    		printf("%d",savbalance);}
    		break;
    		case 2:
    		gotoxy(32,5);
    		printf("WITHDRAW");
    		gotoxy(28,9);
    		printf("CURRENT ACCOUNT");
    		gotoxy(28,10);
    		printf("Enter Amount:Php ");
    		scanf("%d",&amount);
    		c=amount%100;
    		if(amount>5000)
    {printf("\n\n\n\t\tSorry !!! You have entered an invalid amount");
      printf("\n\n\t\tyou can only withdraw an amount less than or equal to 5000");}
    		else if(c!=0)
    {printf("\n\n\n\t\tSorry !!! You have entered an invalid amount" );
    printf("\n\n\t\tyou can only withdraw an amount multiples of 100");}
    		else if(amount>curbalance)
    {printf("\n\n\n\n\t\tSorry !!!You do not have enough balance in your account");
    printf("\n\n\t\tPlease inquire for your balance first before withdrawing");}
    		else
    		{
    		gotoxy(28,13);
    		delay(1000);
    		printf("Balance:Php ");
    		printf("%d",curbalance);
    		gotoxy(28,16);
    		delay(1000);
    		printf("Amount Withdrawn:Php ");
    		printf("%d",amount);
    		curbalance=curbalance-amount;
    		gotoxy(28,19);
    		delay(1000);
    		printf("Total Balance:Php ");
    		printf("%d",curbalance);}
    		break;
    		default:
    		gotoxy(30,10);
    		printf(" SORRY !!!");
    		gotoxy(20,12);
    		printf(" We cannot process your desired account");
    		gotoxy(22,14);
    		printf("you might have entered the wrong choice ");
    		break;}
    		break;
    	case 3:
    		gotoxy(30,10);
    		printf("DEPOSIT");
    		gotoxy(28,14);
    		printf("[1]SAVINGS");
    		gotoxy(28,17);
    		printf("[2]CURRENT");
    		gotoxy(28,20);
    		printf("select account:");
    		scanf("%d",&account);
    		delay(100);
    		clrscr();
    		switch(account)
    	       { case 1:
    	       gotoxy(30,5);
    	       printf("DEPOSIT");
    		gotoxy(28,9);
    		printf("SAVINGS ACCOUNT");
    		gotoxy(28,10);
    		printf("Enter Amount:");
    		scanf("%d",&amount);
    		c=amount%100;
    	       if(amount>5000)
    {printf("\n\n\n\t\t SORRY !!! You have entered an invalid Amount\n");
    printf("\n\t\tYou can only deposit an  amount less than or equal to 5000"); }
    	      else if(c!=0)
    {printf("\n\n\n\t\t SORRY !!! You have entered an invalid Amount");
    printf("\n\n\t\tYou can only deposit an amount multiple of 100");}
    		else
    	       {
    	       delay(1000);
    	       printf("Balance:");
    	      printf("%d",savbalance);
    	       gotoxy(28,16);
    	       delay(1000);
    		printf("Amount Withdrawn:");
    		printf("%d",amount);
    		savbalance=savbalance+amount;
    		gotoxy(28,19);
    		delay(1000);
    		printf("Total Balance:");
    		printf("%d",savbalance);}
    		break;
    		case 2:
    		gotoxy(32,5);
    		printf("DEPOSIT");
    		gotoxy(28,9);
    		printf("CURRENT ACCOUNT");
    		gotoxy(28,10);
    		printf("Enter Amount:");
    	       scanf("%d",&amount);
    		c=amount%100;
    	       if(amount>5000)
    {printf("\n\n\n\t\tSorry !!! You have entered an invalid Amount\n");
    printf("\n\n\t\tYou can only deposit an amount less than or equal to 5000"); }
    		else if(c>0)
    {printf("\n\n\n\t\tSorry !!! You have entered an invalid Amount");
    printf("\n\n\t\tYou can only deposit an amount multoples of 100");}
    		else if(amount>curbalance)
    {printf("SORRY !!!");
    printf("\n\n\n\n\t\tYou do not have enough balance in your Account");}
    		else
    		{gotoxy(28,13);
    		delay(1000);
    		printf("Balance:Php ");
    		printf("%d",curbalance);
    		gotoxy(28,16);
    		delay(1000);
    		printf("Amount Withdrawn:Php ");
    		printf("%d",amount);
    		curbalance=savbalance+amount;
    		gotoxy(28,19);
    		delay(1000);
    		printf("Total Balance:Php ");
    		printf("%d",curbalance);}
    		 break;
    		default:
    		gotoxy(30,10);
    		printf(" SORRY !!!");
    		gotoxy(20,12);
    		printf(" We cannot process your desired account");
    		gotoxy(22,14);
    		printf("you might have entered the wrong choice ");
    		break;}
    		break;
    	case 4: /*nain menu*/
    		delay(1000);
    		printf("\n\n\n\n\n\n\t\tTHANK YOU FOR BANKING WITH US!!!!!\n");
    		delay(1000);
    		clrscr();
    		gotoxy(25,25);
    		printf("PLEASE REMOVE YOUR CARD");
    		getche();
    		return(0);
    		break; }
    		gotoxy(28,26);
    		printf("TRANSACT AGAIN?[y/n]");
    		scanf("%c",&more);
    		more=getchar();
    		clrscr();
    		 }
    		getche();
    		return(0);
    		}

  2. #2
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    please help me on my project. i want my program to print this message "your account is closed .........etc" once i entered PIN three times incorrectly
    use a loop , and think a bit..
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assembly amature question: prog errors
    By geek@02 in forum Tech Board
    Replies: 1
    Last Post: 10-03-2008, 02:35 PM
  2. need help making a dot bounce up and down y axis in this prog
    By redwing26 in forum Game Programming
    Replies: 10
    Last Post: 08-05-2006, 01:48 PM
  3. Getting input from another prog?
    By Badman3k in forum C Programming
    Replies: 4
    Last Post: 11-11-2004, 02:58 AM
  4. ATM prog
    By giovs in forum C Programming
    Replies: 4
    Last Post: 10-06-2004, 07:38 AM
  5. YangHui triangle print test prog?
    By toysoldier in forum C++ Programming
    Replies: 8
    Last Post: 08-20-2004, 09:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21