C-language after ATM first attempt

Source: Internet
Author: User

#include <stdio.h>
#define PASSWORD 9527
#define RMB 100000
#define DORROR 10000
void exit (int x)
{
while (x! = 0)
{
printf ("0:cancle\n");
scanf ("%d", &x);
}
Return
}
void Take (int choice,int a[])
{
int x;
while (choice)
{
if (choice = = 1)
{
System ("CLS");
printf ("You want-take Money:¥");
scanf ("%d", &x);
A[0]-= x;
printf ("success! Your rmb:%d\n ", a[0]);
Exit (choice);
}
if (choice = = 2)
{
System ("CLS");
printf ("You want-take money:$");
scanf ("%d", &x);
A[1]-= x;
printf ("success! Your rmb:%d\n ", a[1]);
Exit (choice);
}
System ("CLS");
printf ("Pls input the sort of money which want to take:\n");
printf ("1:rmb 2:dollor 0:cancle\n");
scanf ("%d", &choice);
}
Return
}
void Save (int choice,int a[])
{
int x;
while (choice)
{
if (choice = = 1)
{
System ("CLS");
printf ("You want to save Money:¥");
scanf ("%d", &x);
A[0] + = x;
printf ("success! Your rmb:%d\n ", a[0]);
Exit (choice);
}
if (choice = = 2)
{
System ("CLS");
printf ("You want to save money:$");
scanf ("%d", &x);
A[1] + = x;
printf ("success! Your rmb:%d\n ", a[1]);
Exit (choice);
}
System ("CLS");
printf ("Pls input the sort of money which want to save:\n");
printf ("1:rmb 2:dollor 0:cancle\n");
scanf ("%d", &choice);
}
Return
}
void examine (int choice,int a[2])
{
while (choice! = 0)
{
if (choice = = 1)
{
System ("CLS");
printf ("rmb:%d\n", a[0]);
Exit (choice);
}
else if (choice = = 2)
{
System ("CLS");
printf ("dollor:%d\n", a[1]);
Exit (choice);
}
System ("CLS");
printf ("Pls input the sort of money which-want to search for:\n");
printf ("1:rmb 2:dollor 0:cancle\n");
scanf ("%d", &choice);
}
Return
}
void Main ()
{

int i,password,choice,choice1,choice2,choice3;
int A[2]={rmb,dorror};

printf ("********************************************************\n");
printf ("* ATM *\n");
printf ("* Welcome to Feneration Bank *\n");
printf ("*---------------------------------------*\n");
printf ("* Owner:excalibur Version number:1.0.1 *\n");
printf ("*---------------------------------------*\n");
printf ("* telephone:028-81484128 *\n");
printf ("*-----------------------*\n");
printf ("* *\n");
printf ("* If you had any QUESTION,PLS does not contact with us *\n");
printf ("********************************************************\n");
printf ("Pls insert your card and input password:");
scanf ("%d", &password);
for (i = 0;i < 2;i++)
{
if (password = = password)
{
Break
}
printf ("Your password is wrong,pls input again:");
scanf ("%d", &password);
}
if (i = = 2)
{
printf ("Sorry,you has input 3 times wrong password!\n");
printf ("Your money had been confiscated!\n");
printf ("Pls do not contact with us! \ n ");
Return
}
System ("CLS");
printf ("Pls input your requirement:\n");
printf ("1:examine balance 2:saving 3:take out 0:cancle\n");
scanf ("%d", &choice);
while (choice! = 0)
{
if (choice = = 1)
{
System ("CLS");
printf ("Pls input the sort of money which-want to search for:\n");
printf ("1:rmb 2:dollor 0:cancle\n");
scanf ("%d", &choice1);
Examine (choice1,a);
}
if (choice = = 2)
{
System ("CLS");
printf ("Pls input the sort of money which want to save:\n");
printf ("1:rmb 2:dollor 0:cancle\n");
scanf ("%d", &choice2);
Save (Choice2,a);
}
if (choice = = 3)
{
System ("CLS");
printf ("Pls input the sort of money which want to take:\n");
printf ("1:rmb 2:dollor 0:cancle\n");
scanf ("%d", &choice3);
Take (Choice3,a);
}
System ("CLS");
printf ("1:examine balance 2:saving 3:take out 0:cancle\n");
scanf ("%d", &choice);
}

}

C-language after ATM first attempt

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.