日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

c语言将数组变为空,求助~~ 如何把数组变成动态输入的?

發布時間:2025/3/19 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c语言将数组变为空,求助~~ 如何把数组变成动态输入的? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

該樓層疑似違規已被系統折疊?隱藏此樓查看此樓

代碼在這里

#include

#include

#include

int card[6][20];

int pass_word(int num)//判斷輸入卡號

{

int i,j=7;

if(num<0) j=8;

for(i=0;i<6;i++)

if(num==card[i][0]) j=i;

return j;

}

void get_mony(int i) //取款

{

int j,k;

printf("Please input your money:\n\n");

scanf("%d",&j); if(card[i][2]<11)

{

if(j

{

card[i][1]=card[i][1]-j;

card[i][2]=card[i][2]+1;

k=card[i][2]; //交易次數

card[i][k+2]=-j; //存放第i 張卡當日第k次交易的取款金額,負值代表取款 }

else printf("Sorry ! Your balance has been insufficient\n\n");//對不起 您的余額已不足

}

else printf("Sorry Today you have no remaining business times\n");

}

void deposit(int i)//存款

{

int j,k;

printf("Please input your money:\n\n");

scanf("%d",&j);

if(card[i][2]<11)

{

card[i][1]=card[i][1]+j;

card[i][2]=card[i][2]+1;

k=card[i][2]; //交易次數

card[i][k+2]=j; //存放第i 張卡當日第k次交易的存款金額,正值代表存款

}

else printf("Sorry Today you have no remaining business times\n");

}

void money_ck(int i) //余額查詢

{

int j=3;

printf("Your balance : %d\n\n",card[i][1]);//剩余余額

printf("Today the number of your trades: %d\n\n",card[i][2]);//已經完成存/取的次數

printf("The remainder number of the trades: %d\n\n",(17-card[i][2]));//每天最多可進行存取一共17次,剩余次數

if (card[i][j]!=0)

{

printf("Your Check list : \n");

printf("Order of trades Amounts\n");//交易次序 交易金額

while(card[i][j]!=0)//存/取列表

{

printf("%8d %d\n",(j-2),card[i][j]);

j++;

}

printf("\n\n");

}

else printf("You didn't take any deal today\n\n");

} void main()

{

int data1,data2;

int i,t;

int data3=1,j=1; card[0][0]=123;

card[0][1]=5000;

card[0][2]=0; card[1][0]=456;

card[1][1]=3500;

card[1][2]=0; card[2][0]=789;

card[2][1]=4000;

card[2][2]=0;

printf("\nWelcome to the industrial and Commercial Bank of China\n\n"); while(data3)

{

printf("If you want to enter the menue,please input 1 :\n");

printf("If you want to quit,please input 0 :\n");

scanf("%d",&t);

if(t==1)

{

printf("Please input your card's number :\n");

scanf("%d",&data1);

data2=pass_word(data1);

if((data2<6)&&(data2>=0))

{

while(j)

{

printf("**************************************\n\n");

printf("Teller ---1 Balance inquiry---2\n\n");//1 取款 2 余額查詢

printf("Deposit---3 ESC ---4\n\n"); //3 存款 4 退出操作

printf("**************************************\n\n");

scanf("%d",&i);

switch(i)

{

case 1 : get_mony(data2); //取款

break;

case 2 : money_ck(data2); //余額查詢

break;

case 3 : deposit(data2); //取款

break; case 4 : j=0; //結束

break;

default: printf("Sorry Error Operating\n");

break;

}

}

}

}

if(data2==7)//卡號錯誤處理

{

printf("Sorry card's number is worong\n\n");

}

if(data2==8)//輸入負卡號處理

{

printf("Sorry Error Operating\n\n");

data3=0;

}

j=1;

if(t==0)

{data3=0;

break;

}

else

{ printf("Sorry Error Operating\n\n");

}

}

}

總結

以上是生活随笔為你收集整理的c语言将数组变为空,求助~~ 如何把数组变成动态输入的?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。