當前位置:首頁 » 編程語言 » atm程序c語言

atm程序c語言

發布時間: 2023-01-09 14:40:53

❶ 用c語言怎麼編寫ATM機的程序

把「clrscr();」改為 system("cls");

❷ 在C語言中ATM自動取款機的功能程序怎麼寫啊

這么難的一個程序才十分?

這是一個很系統的東西,機器那裡只是讀取相關信息,然後將交易信息發到聯網系統里,按照返回的信息,顯示相關內容。

❸ 用C語言模擬ATM機工作流程編程

#include
"stdio.h"對ATM機器的模擬就是一個對隊列的模擬下面代碼在VC6環境下調試已經通過了其中有個缺陷就是因為代碼執行速度過快導致二次執行根據時間隨機出來的數字都是一樣的因此你可以自己加上一個延遲子程序部分功能已經注釋了#include
"stdlib.h"#include
"time.h"#define
OK
1#define
ERROR
0
typedef
struct
node{
int
number;
struct
node*
next;}*Lnode;
typedef
struct
list{
node
*head,*rear;}*Plist;
//模擬
ATM開業bool
ListInit(Plist
list){
Lnode
p;
p
=
(Lnode)malloc(sizeof(Lnode));
list->head
=
p;
list->rear
=
list->head;
list->head->next
=
NULL;
if(list->head!=NULL)
return
ERROR;
else
return
OK;}
//模擬
有客戶排隊bool
ListInsert(Plist
list,int
number){
Lnode
p;
p
=
(Lnode)malloc(sizeof(Lnode));
if(p==NULL)
return
ERROR;
else
{
p->number
=
number;
p->next
=
NULL;
list->rear->next
=
p;
list->rear
=
p;
return
OK;
}}
//模擬
客戶辦完事離開bool
ListDelete(Plist
list){
Lnode
p;
if(list->head
==list->rear)
return
ERROR;
else
{
p
=
list->head->next;
list->head->next
=
p->next;
list->rear
=
list->head;
//
free(p);
return
OK;
}}
void
sand(int*
gettime,int*
needtime){
srand(time(NULL))
;
*gettime
=
rand()%100;
srand(time(NULL))
;
*needtime
=rand()%100;}
//模擬客戶到達事件void
CustomerArrived(Plist
list,int
gettime,int
needtime,int
kehu,int
time){
int
nextgettime,nextneedtime;
sand(&nextgettime,&nextneedtime);
while(needtime>0
&&
nextgettime>0
&&
time>0)
{
needtime
--;
nextgettime
--;
time
--;
}
if(nextgettime
==
0
&&
needtime>0
&&time>0)
{
kehu++;
ListInsert(list,kehu);
while(needtime>0
&&
time>0)
{
needtime--;
time
--;
}
ListDelete(list);
CustomerArrived(list,nextgettime,nextneedtime,kehu,time);
}
if(needtime
==0
&&
nextgettime>0
&&
time>0)
{
ListDelete(list);
while(nextgettime>0
&&
time>0)
{
nextgettime--;
time
--;
}
kehu++;
ListInsert(list,kehu);
//未刪除
,list未傳遞進去
CustomerArrived(list,nextgettime,nextneedtime,kehu,time);
}
if(time
==0)
{
printf("ATM關門,請明天在來!\n");
return;
}}
main(){
list
list;
int
i
=
10000;
//ATM機器每天工作時間
int
kehu
=
0;
//客戶標號
int
gettime,needtime;
ListInit(&list);
//ATM開業
sand(&gettime,&needtime);
ListInsert(&list,kehu);
CustomerArrived(&list,gettime,needtime,kehu,i);
getchar();
}

❹ 怎樣用c語言編寫ATM系統

#include<stdio.h>
#include<string.h>
void print_welcome();
int main()
{
print_welcome();
char c[11]="1234567890",d[7]="123456";
char a[20],b[20];
char p,q;
int h=0,i=0,j=0,k,l=0;
do
{
printf("請輸入賬號:\n");
gets(a);
printf("請輸入密碼:\n");
gets(b);
if(strcmp(c,a)==0&&strcmp(d,b)==0)
{
printf("賬號正確 歡迎使用\n");
h++;
}
else
printf("賬號或密碼錯誤請重新輸入\n");
}while(h!=1);
do
{
print_welcome();
retrn:
printf("請選擇對應的字母\n");
printf(" a存款業務 \n");
printf(" b余額查詢\n");
printf(" c資金轉賬\n");
printf(" d取款業務\n");
printf(" e退卡\n");
printf("請選擇您要辦理的業務\n");
scanf("%c",&p);
getchar();
switch(p)
{
case'a':printf(" 存款業務\n");
printf("**本服務暫停 請重新選擇**\n");
break;
case'b':
printf(" 余額查詢\n");
printf("**您的余額為 ¥9999999\n請重新選擇**\n");
break;
case'c':
printf(" 資金轉賬\n");
printf("**您的銀行卡不支持該業務 請重新選擇**\n");
break;
case'd':
printf(" 取款業務\n");
do
{
printf("請選擇您要取款的金額\n**請輸入序號\n**請您注意每位用戶每天只能去20000 每次最多取2500\n");
printf(" r 100\n");
printf(" s 200\n");
printf(" t 500\n");
printf(" u 1000\n");
printf(" v 2000\n");
printf(" w 其他\n");
printf(" x 返回\n");
printf("請選擇要取的金額\n");
scanf("%c",&q);
getchar();
switch(q)
{
case'r':printf("**取款成功 金額為100元**");goto retrn;break;
case's':printf("**取款成功 金額為200元**");goto retrn;break;
case't':printf("**取款成功 金額為500元**");goto retrn;break;
case'u':printf("**取款成功 金額為1000元**");goto retrn;break;
case'v':printf("**取款成功 金額為2000元**");goto retrn;break;
case'w':printf("**請輸入你想取出的金額**\n**並保證是100的倍數\n");
while(l!=1)
{
scanf("%d",&k);
getchar();
if(k%100==0&&k>=0&&k<=2500)
{
printf("您取出的金額%d元\n",k);
l++;
goto retrn;
}
else
{
printf("您輸入的面額有誤請重新輸入\n");
printf("請您保證為100的倍數\n");
}
}
break;
case'x':goto retrn;break;
default:printf("**操作有誤請從新輸入**");
j++;
}
}while(j!=1);
break;
case'e':
printf("**歡迎您的使用 請勿忘取卡**\n");
i++;
break;
default:printf("**操作有誤請從新輸入**\n");
}
}while(i!=1);
print_welcome();
return 0;
}
void print_welcome()
{
printf(" **歡迎使用**\n");
}

❺ 用c語言,結構體設計atm

密碼 余額
存款:
1 存款數額為正數,不符合報錯
2 余額 = 初始余額 + 存款金額
取款:
1 取款數額為100的倍數,不符合報錯
2 余額 = 初始余額–取款金額
取款總額不大於余額
僅需要做兩個函數,我曾經做過一個ATM機的模擬系統

❻ 用C語言寫ATM的程序代碼要求用循環語句

#include<stdio.h>
int chaxun(int a3)
{
int b;
b=a3;
printf("你的余額為:%d\n",b) ;

}
int qukuan(int a3)
{
int a,b;
printf("請輸入您要提取的現金:\n");
scanf("%d",&a);
b=a3-a;
if(b<0)
printf("對不起 ,你的余額不足\n");
else
{
printf("請收好您的%d元現金\n",a);
a3=a3-a;
}
return (a3);
}
int gaini(int a2)
{
int a,b,c=1,d,e=1;
while(e)
{
printf("請輸入你的舊密碼:\n");
scanf("%d",&d);
if(d==a2)
e=0;
else
{
e=1;
printf("你輸入的密碼錯誤,請重新輸入:\n");
}
}
while(c)
{
printf("請輸入您的六位數新密碼\n");
scanf("%d",&a2);
printf("請確認您的六位數新密碼\n");
scanf("%d",&b);
if(a2==b)
{
if(b>100000&&b<999999&&b/(b/100000)!=111111)
{
c=0;
printf("密碼修改成功\n");
}
else
{
printf("您輸入的密碼不符合要求,請從新輸入\n");
c=1;

}
}
else
{
c=1;
printf("您兩次輸入的密碼不一致,請重新輸入:\n");
}

}
return a2;
}
int quka()
{
printf("\n 夢若保保提醒您\n");
printf("請收好您的卡片,謝謝,再見\n\n");
}
int cunkuan(int a3)
{
int i,j,k;
printf("請輸入你要存的金額\n");
scanf("%d",&k);
if(k<0)
{
printf("對不起,沒有負存款\n");
}
else
{
printf("\n您好,您已經存進去了%d元\n",k);
a3=a3+k;
}
return a3;
}

main()
{
int i,j,b=1,c,k,l,m,n;
int a1=123456,a2=123456,a3=1000;
printf("歡迎使用自動櫃員機:\n\n");
while(b==1)
{
printf("請輸入您的賬號:\n");
scanf("%d",&k);
printf("請輸入您的密碼:\n");
scanf("%d",&l);
if(k==a1&&l==a2)
{
b=0;
printf("您的賬戶余額為:%d\n",a3);
}
else
{
b=1;
printf("對不起,您輸入的賬號或者密碼有誤,請重新輸入:\n");
}
}
do
{
printf("\n請選擇您要的服務項目:\n");
printf("1.查詢余額\n");
printf("2.取款\n");
printf("3.修改密碼\n");
printf("4.取卡\n");
printf("5.存款\n");
scanf("%d",&c);
switch(c)
{
case 1:
chaxun(a3);
break;
case 2:
a3=qukuan(a3);
break;
case 3:
a2=gaini(a2);
break;
case 4:
quka();
break;
case 5:
a3=cunkuan(a3);
break;
}
}while(c!=4);

}

熱點內容
java求絕對值 發布:2025-07-10 14:10:55 瀏覽:651
usb調試開關在哪裡安卓 發布:2025-07-10 13:59:55 瀏覽:76
資料庫維度 發布:2025-07-10 13:54:31 瀏覽:798
c語言位域的賦值 發布:2025-07-10 13:54:30 瀏覽:582
查成績密碼忘了怎麼辦 發布:2025-07-10 13:52:21 瀏覽:818
java死 發布:2025-07-10 13:51:30 瀏覽:995
車輛設施配置有哪些 發布:2025-07-10 13:42:28 瀏覽:819
java的成員 發布:2025-07-10 13:38:59 瀏覽:719
荒島餘生ftp 發布:2025-07-10 13:36:46 瀏覽:921
賽車配置有哪些車型 發布:2025-07-10 13:35:15 瀏覽:512