C Language Realization ATM machine

Source: Internet
Author: User

#include <stdio.h>

#include <stdlib.h>


void Chaxun (A3)

{

int b;

b = A3;

printf ("Your Balance:%d\n", b);

}


int Qukuan (int a3)

{

int a=0, b=0;

printf ("Please enter the amount to be taken: \ n");

scanf ("%d", &a);

b = a3-a;

if (b < 0)

{

printf ("Your balance is not sufficient \ n");

}

Else

{


printf ("Please take your%d dollar cash \ n", a);

A3 = A3-a;

}

return A3;


}


int Gaimi (int A2)

{

int B, d, C = 1, E = 1;

while (e)

{

printf ("Please enter your original password \ n");

scanf ("%d", &d);

if (a2 = = d)

{

e = 0;

}

Else

{

e = 1;

printf ("Password is wrong, please re-enter \ n");

}

}

while (c)

{

printf ("Please enter your new password \ n");

scanf ("%d", &A2);

printf ("Please confirm your new password \ n");

scanf ("%d", &b);

if (a2 = = b)

{

printf ("Password modification succeeded \ n");

c = 0;

}

Else

{

c = 1;

printf ("The two inputs are inconsistent, please re-modify \ n");


}

}

return A2;

}


void Quka ()

{

printf ("Please accept your card \ n");

printf ("Thank you, goodbye \ n");

}


int Cunkuan (int a3)

{

int k = 0;

printf ("Please enter the amount you want to deposit \ n");

scanf ("%d", &k);

A3 = A3 + K;

printf ("Your total amount is%d\n", A3);


return A3;

}


int main ()

{

int B = 1, C, K, l, q = 1;

int a1 = 123456, a2 = 123456, a3 = 1000;

printf ("Welcome to ATM machine \ n");

while (q)

{

printf ("Please enter your account \ n");

scanf ("%d", &k);

printf ("Please enter password \ n");

scanf ("%d", &l);

if (A1 = = K&&a2 = = L)

{

printf ("Your account balance is%d", A3);

q = 0;

}

Else

{

printf ("Your password is wrong, please re-enter \ n");

Q = 1;

}

}

do{

printf ("Please select \ n");

printf ("1 query \ n");

printf ("2 withdrawals \ n");

printf ("3 Change password \ n");

printf ("4 fetch card \ n");

printf ("5 deposit \ n");

scanf ("%d", &c);

Switch (c)

{

Case 1:

Chaxun (A3);

Break

Case 2:

A3 = Qukuan (A3);

Break

Case 3:

A2 = Gaimi (A2);

Break

Case 4:

Quka ();

Break

Case 5:

Cunkuan (A3);

Break

Default

Break

}

} while (c! = 4);


Return

}


C Language Realization ATM machine

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.