欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

c語言查詢余額的函數(shù),C語言余數(shù)函數(shù)

C語言查找函數(shù)

首先,指針默認(rèn)只有一個地址的長度的空間,存不了那么多的字符。

成都創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),柳河企業(yè)網(wǎng)站建設(shè),柳河品牌網(wǎng)站建設(shè),網(wǎng)站定制,柳河網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,柳河網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。

其次,傳值和傳地址一塌糊涂,完全就是亂寫么。

scanf的第二個參數(shù)是地址,如果本身不是指針則需要取址符。

我給你重寫了算了

#includestdio.h

int Retrieve(int array[],int length,int x);/*形參x直接傳值就可以了*/

int main()

{

int *a,x;

int length,i;

scanf("%d",length);

a = (int)malloc(sizeof(int)*length); /*申請一個內(nèi)存空間用來存放數(shù)據(jù),或者直接用一個大數(shù)組也可以*/

c語言中,怎樣使用取余數(shù)的函數(shù)

C語言提供了一個取余數(shù)的運算符%,稱之為“模”運算符,只有兩個整數(shù)之間才可以進行模運算。

a % b 表示 用b來整除a,商整數(shù),得到余數(shù)。

如:

5%3 = 2

4%3 =1

3%3 =0

擴展資料:

數(shù)學(xué)函數(shù)

double log10(double x) 返回log10x的值

double pow(double x,double y) 返回x^y的值

double?pow10(int p) 返回10^p的值

double sqrt(double x) 返回+√x的值

double acos(double x) 返回x的反余弦cos-1(x)值,x為弧度

double asin(double x) 返回x的反正弦sin-1(x)值,x為弧度

double atan(double x) 返回x的反正切tan-1(x)值,x為弧度

double atoi(char *nptr) 將字符串nptr轉(zhuǎn)換成整數(shù)并返回這個整數(shù)

double atol(char *nptr) 將字符串nptr轉(zhuǎn)換成長整數(shù)并返回這個整數(shù)

char *ecvt(double value,int ndigit,int *decpt,int *sign),將浮點數(shù)value轉(zhuǎn)換成字符串并返回該字符串

char *fcvt(double value,int ndigit,int *decpt,int *sign),將浮點數(shù)value轉(zhuǎn)換成字符串并返回該字符串

參考資料來源:百度百科-C語言函數(shù)

c語言怎么從調(diào)用函數(shù)回到主函數(shù)

#include"stdio.h"

#include"string.h"

struct?account

{

char?name[20];

int?money;

}accounts;

void?plm()

{?

printf("您賬戶的余額:%d",accounts.money);

}

void?qwe()

{

int?cunkuan;??

printf("請輸入存款金額:");?

scanf("%d",cunkuan);?

accounts.money=cunkuan+accounts.money;

printf("???存款成功!\n賬戶余額:%d\n",accounts.money);

}

void?poi()

{?

int?qukuan,i;

printf("請輸入取款金額:");

while(1)

{

scanf("%d",qukuan);?

if(accounts.moneyqukuan)

{?

printf("賬戶余額不足!你的賬戶余額:%d\n請重新輸入:",accounts.money);?

}

else?

{

accounts.money=accounts.money-qukuan;

printf("取款成功!\n賬戶余額:%d\n",accounts.money);

break;

}?

}

}

void?main()

{

char?name[20];?

char?mima[20];?

int?q;

printf("====================================================\n");?

printf("====================================================\n");

printf("==================歡迎你使用銀行系統(tǒng)================\n");

printf("====================================================\n");?

printf("====================================================\n\n");

printf("請輸入你的賬戶名:");?

gets(name);

printf("請輸入密碼:");

gets(mima);

printf("\n");

if(strcmp(name,"zengxin")==0strcmp(mima,"12345")==0)

{?

printf("登陸成功!\n");

int?t=1;

while(t)//主函數(shù)加上一個while循環(huán)就好了,t表示是否繼續(xù)使用系統(tǒng),選擇0時,t=1,即可退出系統(tǒng)了

{

printf("???1?存款???2?取款??3?開戶\n");?

printf("???4?銷戶???5?查詢??0?退出\n請選擇:");?

scanf("%d",q);?

switch?(q)?

{?

case?1:

{

qwe();

break;

}?

case?2:

{

poi();

break;

}?

case?3:

break;?

case?4:

break;??

case?5:

{

plm();

break;

}?????

case?0:

{

t=0;

break;

}

}?

}

}

else?

printf("輸入的賬戶名和密碼錯誤!!");

}

用c語言編寫ATM的程序,實現(xiàn)開戶、存款、取款、查詢余額、轉(zhuǎn)賬的業(yè)務(wù)邏輯。

#include stdio.h

#include stdlib.h

#include conio.h

#include string.h

void regist();

void login();

void quite();

void inputpassword(char mima[]);

void service();

struct bank

{

char name[20];

char password[7];

int account;

double money;

}kehu;

int find;

int a[10];

struct bank one;

FILE *fp;

void main()

{

int i;

int t=1;

for(i=0;i100;i++)

{

printf("\t\t\t\t\t\t歡迎使用青軟ATM系統(tǒng)\n");

printf("\t\t\t\t\t\t正在進入主界面,請稍等");

int j;

for(j=1;jt;j++)

{

printf(".");

}

t++;

if(t==10)

{

t=1;

}

printf("\n\t\t\t\t\t\t%d%%",i);

system("cls");

}

while(1)

{

printf("\t\t\t\t\t\t服務(wù)類型: \n");

printf("\t\t\t\t\t\t[a]: 用戶注冊\n");

printf("\t\t\t\t\t\t[b]: 用戶登錄\n");

printf("\t\t\t\t\t\t[c]: 退出系統(tǒng)\n");

printf("\t\t\t\t\t\t請選擇服務(wù): ");

fflush(stdin);

char xz;

scanf("%c",xz);

if(xz=='a'||xz=='A')

{

regist();

} else if (xz=='b'||xz=='B')

{

login();

} else if(xz=='c'||xz=='C')

{

quite();

} else

{

printf("輸入有誤,請重新輸入");

}

getch();

system("cls");

}

}

void inputpassword(char mima[])

{

int i=0;

char ch;

while(1)

{

ch=getch();

if(ch!='\r')

{

if(ch!='\b'){

mima[i]=ch;

i++;

printf("*");

}else{

if(i0){

i--;

printf("\b \b");

}

}

}else{

break;

}

}

mima[i]='\0';

printf("\n");

}

void regist()

{

fp=fopen("atm.txt","ab+");

if(fp==NULL)

{

printf("\n\t\t\t文件打開失敗!");

return;

}

system("cls");

printf("\t\t\t現(xiàn)在執(zhí)行的是注冊函數(shù)的使用\n");

printf("\t\t請輸入用戶名: ");

fflush(stdin);

gets(kehu.name);

char password1[7];

while(1)

{

while(1)

{

printf("\n\n\t\t請輸入密碼:");

fflush(stdin);

inputpassword(kehu.password);

int n=strlen(kehu.password);

if(n==6)

{

break;

}else

{

printf("\n\t\t密碼必須為6位!");

}

}

printf("\n\t\t請輸入正確密碼!: ");

fflush(stdin);

inputpassword(password1);

if(strcmp(kehu.password,password1)==0)

{

break;

}else{

printf("\n\n\t\t兩次密碼必須相同!");

}

}

rewind(fp);

struct bank k;

if(fread(k,sizeof(struct bank),1,fp)==1)

{

fseek(fp,-sizeof(k),2);

fread(k,sizeof(k),1,fp);

kehu.account=k.account+1;

}else{

kehu.account=20170001;

}

kehu.money=0;

fseek(fp,0,2);

fwrite(kehu,sizeof(struct bank),1,fp);

fclose(fp);

printf("\n\n\t\t開戶成功! ");

printf("\n\t\t您的賬號為%d!",kehu.account);

printf("\n\t\t現(xiàn)在請您重新登錄!");

}

void searchmoney()

{

system("cls");

printf("您現(xiàn)在使用的是查詢余額功能: \n");

printf("\n\n\t\t您的余額是%0.2lf",one.money);

}

void savemoney()

{

system("cls");

double inmoney;

printf("請您選擇您要存款的金額 \n");

scanf("%lf",inmoney);

int q;

int r=1;

for(q=0;q100;q++)

{

int w;

for(w=1;wr;w++)

{

printf(".");

}

r++;

if(r==10)

{

r=1;

}

printf("\n\t\t\t\t\t\t正在存款%d%%",q);

system("cls");

}

one.money=one.money+inmoney;

fseek(fp,-sizeof(one),1);

fwrite(one,sizeof(one),1,fp);

printf("\n\n\t\t\t\t\t\t您已存款成功!");

}

void withdrawalmoney()

{

system("cls");

double outputsomemoney;

printf("請您選擇您要取款的金額 \n");

scanf("%lf",outputsomemoney);

if(one.moneyoutputsomemoney){

printf("您的余額已不足,請您注意!");

}else {

int q;

int r=1;

for(q=0;q100;q++)

{

int w;

for(w=1;wr;w++)

{

printf(".");

}

r++;

if(r==10)

{

r=1;

}

printf("\n\t\t\t\t\t\t正在取款%d%%",q);

system("cls");

}

one.money=one.money-outputsomemoney;

fseek(fp,-sizeof(one),1);

fwrite(one,sizeof(one),1,fp);

printf("\n\n\t\t\t\t\t\t您已取款成功!請點清鈔票!");

printf("\n\n\t\t\t\t\t\t您現(xiàn)在的余額為%lf",one.money);

}

}

void transfermoney()

{

system("cls");

int duifang;

int qian;

fflush(stdin);

printf("\n\n\n\t\t您現(xiàn)在使用的是轉(zhuǎn)賬功能");

printf("\n\t\t\t請輸入您要轉(zhuǎn)賬的賬戶:");

scanf("%d",duifang);

int n=ftell(fp);

rewind(fp);

int flag=0;

struct bank temp;

while(fread(temp,sizeof(temp),1,fp)==1)

{

if(temp.account==duifang)

{

flag=1;

break;

}

}

if(flag==1)

{

printf("請輸入轉(zhuǎn)賬金額:");

scanf("%d",qian);

if(one.money=qian)

{

int q;

int r=1;

for(q=0;q100;q++)

{

int w;

for(w=1;wr;w++)

{

printf(".");

}

r++;

if(r==10)

{

r=1;

}

printf("\n\t\t\t\t\t\t正在轉(zhuǎn)賬,請稍后!%d%%",q);

system("cls");

}

temp.money=temp.money+qian;

fseek(fp,-sizeof(temp),1);

fwrite(temp,sizeof(temp),1,fp);

one.money=one.money-qian;

fseek(fp,n-sizeof(one),0);

fwrite(one,sizeof(one),1,fp);

printf("\n\t\t\t\t轉(zhuǎn)賬成功!");

}else{

printf("\n\t\t\t\t您的余額已不足!");

}

}

}

void xiugai(){

system("cls");

printf("\n\n\t\t 現(xiàn)在進行的是修改密碼功能\n");

char oldpassword[7];

char newpassword[7];

char newpassword1[7];

int i;

for(i=0;i3;i++){

printf("\n\t\t\t 請輸入舊密碼:\n");

inputpassword(oldpassword);

if(strcmp(oldpassword,one.password)==0){

printf("\n\t\t\t 輸入成功!\n");

break;

}else{

printf("\n\t\t\t 密碼輸入有誤,請重新輸入!\n");

}

}

if(i3){

while(1){

printf("\n\t\t\t 請輸入您的新密碼:\n");

inputpassword(newpassword);

printf("\n\t\t\t 請輸入您的確認(rèn)密碼:\n ");

inputpassword(newpassword1);

if(strcmp(newpassword,newpassword1)==0){

strcpy(one.password,newpassword);

fseek(fp,-sizeof(one),1);

fwrite(one,sizeof(one),1,fp);

printf("\n\t\t\t 密碼修改成功!");

break;

}else{

printf("\n\t\t\t 兩次密碼輸入不一致!");

}

}

}else{

printf("\n\t\t\t 密碼輸入錯誤!");

}

}

int zhuxiaozhanghao()

{

system("cls");

int zhuxiaoxitong;

char sf;

printf("你要注銷的賬號是%d",one.account);

printf("你是否要對此賬號進行注銷?\n\n\t\t請您選擇:注銷(Y)or不注銷(N):");

fflush(stdin);

scanf("%c",sf);

if(sf=='y'||sf=='Y')

{

printf("正在為您注銷!\n",one.account);

zhuxiaoxitong=1;

}else{

printf("不注銷系統(tǒng)!\n",one.account);

}

return zhuxiaoxitong;

}

void service()

{

while(1){

system("cls");

printf("\n\n\n\t\t\t\t\t\t現(xiàn)在是服務(wù)系統(tǒng),本系統(tǒng)有以下服務(wù)");

printf("\n\t\t\t\t\t\t[a] 查詢余額\n");

printf("\n\t\t\t\t\t\t[b] 存款服務(wù)\n");

printf("\n\t\t\t\t\t\t[c] 轉(zhuǎn)賬服務(wù)\n");

printf("\n\t\t\t\t\t\t[d] 取款服務(wù)\n");

printf("\n\t\t\t\t\t\t[e] 修改密碼\n");

printf("\n\t\t\t\t\t\t[f] 注銷 \n");

printf("\n\t\t\t\t\t\t[g] 退出系統(tǒng)\n");

char e;

printf("\n\t\t\t\t\t\t您要選擇的服務(wù)是:");

fflush(stdin);

scanf("%c",e);

switch(e)

{ case'A':

case'a': searchmoney() ;break;

case'B':

case'b': savemoney() ;break;

case'C':

case'c': transfermoney() ;break;

case'D':

case'd': withdrawalmoney() ;break;

case'E':

case'e': xiugai() ;break;

case'F':

case'f': {int zhuxiaoxitong=zhuxiaozhanghao();{if(zhuxiaoxitong==1) return;}break;}

case'G':

case'g': quite();break;

}

printf("\n\n\n\t\t\t\t按任意鍵繼續(xù)......\n");

getch();

}

}

void login()

{

fp=fopen("atm.txt","rb+");

if(fp==NULL)

{

printf("\n\n\n\t\t\t\t文件打開失敗!");

return;

}

system("cls");

printf("\n\t\t\t\t\t\t現(xiàn)在執(zhí)行的是登錄函數(shù)的使用\n");

int zhanghao;

printf("\n\t\t\t\t\t\t請輸入賬號:");

scanf("%d",zhanghao);

int flag=0;

while(fread(one,sizeof(one),1,fp)==1)

{

if(zhanghao==one.account){

flag=1;

break;

}

}

char password2[7];

if(flag==1){

int h;

for(h=0;h3;h++){

printf("\n\t\t\t\t\t\t請輸入密碼:");

fflush(stdin);

inputpassword(password2);

if(strcmp(password2,one.password)==0)

{

printf("\n\t\t\t\t\t\t登陸成功!");

service();

break;

}else{

printf("密碼不正確!");

}

}

if(h==3){

printf("\n\t\t\t您的密碼三次輸入有誤,返回");

}

}else{

printf("無此賬號!");

}

fclose(fp);

}

void quite()

{

system("cls");

printf("\t\t\t現(xiàn)在執(zhí)行的是退出函數(shù)的使用\n");

exit(0);

}

怎樣用c語言編寫ATM系統(tǒng)

真正的ATM系統(tǒng)不可能只是用C語言編寫的,它應(yīng)該是一套完整獨立的系統(tǒng),核心代碼更機密,不會輕易的泄露。

C語言可以寫一個類似于ATM系統(tǒng)的框架,用以模擬ATM機上的各種操作。

框架代碼如下:

#includeiostream.h??

#includestdio.h??

int?main()???

{??

int?choice?=-?1;???

while(1)?{??

printf("請選擇\n1.login\t2.regist\n");??

scanf("%d",?choice);??

switch(choice)?{??

case?1:??

login();??

break;??

case?2:??

regist();??

break;??

default:??

printf("輸入有誤,重新輸入\n");??

break;??

}??

}??

return?0;

}??

void?login()?{??

printf("IN?LOGIN\n");??

int?flag?=?-1;??

int?X?=?-1;??

printf("輸入賬戶和密碼\n");??

flag?=?search();??

if(falg?==?1)?{??

printf("存在,進入主頁面\n");??

X?=?menu();??

if(X?==?1)??

return;??

}??

else?if(flag?==?0)?{??

printf("賬戶或密碼錯誤\n");??

return;???????

}??

}??

int?regist()?{??

printf("IN?REGIST\n");??

return?1;??

}??

int?menu()?{??

printf("IN?MENU\n");??

int?key?=?-1;??

int?N?=?-1;??

while(1)?{??

printf("請選擇業(yè)務(wù):1.refer\t2.deposit\t3.withdraw\t4.transfer\t5.resetPW\t6.退出\n");??

scanf("%d",?key);??

switch(key)?{??

case?1:??

N?=?refer();??

break;??

case?2:??

N?=?deposit();??

break;??

case?3:??

N?=?withdraw();??

break;??

case?4:??

N?=?transfer();??

break;??

case?5:??

N?=?resetPW();??

break;??

case?6:??

N?=?6;??

return?1;??

break;??

default:??

printf("輸入有誤,重新選擇:\n");???

break;??

}??

if(N%2?==?0)?{??

printf("Error!\n");??

}???

}??

}??

int?refer()?{??

printf("IN?REFER\n");??

//輸出余額???

return?1;??

}??

int?deposit()?{??

printf("IN?DEPOSIT\n");??

//存錢???

return?3;??

}??

int?withdraw()?{??

printf("IN?WITHDRAW\n");??

//取錢???

return?5;??

}??

int?transfer()?{??

ptintf("IN?TRANSFER\n");??

//轉(zhuǎn)賬???

return?7;??

}??

int?resetPW()?{??

prtintf("IN?RESETPW\n");??

//重設(shè)密碼???

return?9;??

}

c語言。結(jié)構(gòu)體已經(jīng)獲得了數(shù)據(jù),怎么調(diào)用自定義函數(shù)來處理這個結(jié)構(gòu)體的數(shù)據(jù)?就是自定義函數(shù)要怎么寫

我寫了個程序,你可以看一下,代碼放附件里了,下面是運行的部分截圖。基本你說的功能都有,如果有其他需要可以自行補充,方法都差不多。希望能幫到你。

int login(struct mesinfo *); //登入賬戶函數(shù)

void check(struct mesinfo *); ?// ?查詢賬戶余額和透支額函數(shù)

void transfer(struct mesinfo *); // ?轉(zhuǎn)賬函數(shù) ? ? ? ? ? ? ? ? ?

void draw(struct mesinfo *); // ? ? ?提取現(xiàn)金函數(shù) ? ? ? ? ? ? ?

void store(struct mesinfo *); ? ?// ? ?存入現(xiàn)金函數(shù) ? ? ? ? ? ? ? ?

void printList(char *id,int type,int money,char *time);// ? ? 打印憑條函數(shù)

void quit(struct mesinfo *);// ? ?退出函數(shù)

當(dāng)前文章:c語言查詢余額的函數(shù),C語言余數(shù)函數(shù)
文章源于:http://chinadenli.net/article1/dsgohid.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)電子商務(wù)自適應(yīng)網(wǎng)站品牌網(wǎng)站設(shè)計App開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作