ATM Simulation Program

Source: Internet
Author: User

A very simple ATM simulation program

1#include <stdio.h>2 voidChaxun (intA3) {3     intb;4b=A3;5printf"your balance is:%d\n", b);6 } 7 8 intQukuan (intA3) {9     intb;Tenprintf"Please enter the cash you want to withdraw: \ n"); Onescanf"%d",&a); Ab=a3-A; -     if(b<0) -printf"Sorry, your balance is not enough \ n"); the     Else{ -printf"Please accept your cash.", a); -a3-=A; -     } +     returnA3; - } +  A intGaimi (intA2) { at     intB,c=1, d,e=1; -      while(e) { -printf"Please enter your old password: \ n"); -scanf"%d",&d); -         if(d==A2) -E=0; in         Else{ -E=1; toprintf"your password is wrong, please re-enter: \ n"); +         } -     } the      while(c) { *printf"Please enter your six digit new password \ n"); $scanf"%d",&A2);Panax Notoginsengprintf"Please enter your six digit new password \ n"); -scanf"%d",&b); the         if(a2==b) { +             if(b>100000&&b<999999&& (b/100000)!=111111){ AC=0; theprintf"Change password successfully \ n");  +             } -             Else{ $printf"The password you entered does not meet the requirements, please re-enter \ n"); $C=1; -             } -         } the         Else{ -C=1;Wuyiprintf"you entered the password two times inconsistent, please re-enter: \ n"); the         } -     } Wu     returnA2; - } About  $ voidQuka () { -printf"\ n remind you \ n"); -printf"Please accept your card, thank you, goodbye \ n"); - } A  + intCunkuan (intA3) { the     intK; -printf"Please enter the amount you want to save \ n"); $scanf"%d",&k); the     if(k<0){ theprintf"Sorry, no negative deposit \ n"); the     } the     Else{ -printf"\ n Hello, you have saved%d dollars \ n", k); ina3+=K; the     } the     returnA3; About } the  the intMain () { the     intb=1, c,k,l; +     inta1=123456, a2=123456, a3= +; -printf"Welcome to Automatic teller machine: \ n"); the      while(b==1){Bayiprintf"Please enter your account number: \ n"); thescanf"%d",&k); theprintf"Please enter your password: \ n"); -scanf"%d",&l); -         if(k==a1&&l==A2) { theb=0; theprintf"Your account balance is:%d\n", A3); the         } the         Else{ -b=1; theprintf"Sorry, the account or password you entered is incorrect, please re-enter: \ n"); the         } the     }94      the      Do{ theprintf"\ n Please select the service item you want: \ n"); theprintf"1. Check the balance \ n");98printf"2. Withdrawals \ n"); Aboutprintf"3. Change password \ n"); -printf"4. Pick up the card \ n");101printf"5. Deposit \ n");102scanf"%d",&c);103         104         Switch(c) { the              Case 1:106 Chaxun (A3);107                  Break;108              Case 2:109A2=Qukuan (A3); the                  Break;111              Case 3: theA2=Gaimi (A2);113                  Break; the              Case 4: the Quka (); the                  Break;117              Case 5:118a3=Cunkuan (A3);119                  Break; -         }121} while(c!=4);122     return 0;123}

ATM Simulation Program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.