c語言版匯款系統

2021-04-29 01:29:29 字數 4370 閱讀 1431

#include

#include

#include

#include

#define n_maxrec_no 100

#define file_data_path "c:"

#define maxline 256

struct record

;typedef struct record record;

record rs[n_maxrec_no];

int maxaccount;

void welcome();

void mainmenu();

void openanaccount();

void closeanacount();

void deposit();

void withdraw();

void query();

int findanaccount(int accnumber);

void dispanaccount(int i);

int createaccnumber();

int readdata();

int writedata();

int checkinput(int flag, char *checkstr);

char *righttrim(char *str);

void queryall();

void getaccname(char accname);

void getaccpwd(char accpwd);

double getcash();

int getaccnumber(int flag);

void main()

else

else

}} 

}void welcome()

void mainmenu()

}while(choice != 0);

}void openanaccount()

accnumber = createaccnumber();

getaccname(accname);

getaccpwd(accpwd);

cash = getcash(0);

maxaccount++;

rs[maxaccount].accnumber = accnumber;

strcpy(rs[maxaccount].accname,accname);

strcpy(rs[maxaccount].accpwd,accpwd);

rs[maxaccount].balance = cash;

strcpy(rs[maxaccount].flag,"0");

if(writedata())

dispanaccount(maxaccount);

printf("sucess");

getch();

return;

}void closeanacount()

dispanaccount(accountposition);

if (strcmp(rs[accountposition].accpwd ,accpwd) != 0)

if (strcmp(rs[accountposition].flag, "0") != 0)

printf("confirm %d] [1:close|other:no close] ", rs[accountposition].accnumber);

scanf("%c", &useranswer);

fflush(stdin);

if (useranswer == '1')

dispanaccount(accountposition);

printf("sucess");

getch();

return;

}printf("cancel");

getch();

return;

}void deposit()

dispanaccount(accountposition);

if (strcmp(rs[accountposition].flag,"0") != 0)

cash = getcash(0);

rs[accountposition].balance = rs[accountposition].balance + cash;

if(writedata())

dispanaccount(accountposition);

printf("sucess");

getch();

}void withdraw()

dispanaccount(accountposition);

if (strcmp(rs[accountposition].accpwd ,accpwd) != 0)

if (strcmp(rs[accountposition].flag,"0") != 0)

cash = getcash(1);

if (cash > rs[accountposition].balance)

rs[accountposition].balance = rs[accountposition].balance - cash;

if(writedata())

dispanaccount(accountposition);

printf("success");

getch();

}void query()

if (strcmp(rs[accountposition].accpwd, accpwd) != 0)

if (strcmp(rs[accountposition].flag, "0") != 0)

dispanaccount(accountposition);

printf("/n sucess");

getch();

return;

}int createaccnumber()

else

}void queryall()

printf("/npress any key");

getch();

}int findanaccount(int accnumber)

}return accountposition;

}void dispanaccount(int i)

int readdata()

while((!feof(fp)) && ((fgets(clinestr, maxline, fp)) != null))

else

if(j==1)

if(j==2)

if(j==3)

if(j==4)

memset(cdata, 0, sizeof(cdata));

j++;

if(j==5)}}

j = 0;

i++;

}fclose(fp);

i--;

return i;

}int writedata()

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

fclose(fp);

return 0;

}int checkinput(int flag, char *checkstr)

break;

}case 1:

break;

}case 2:

break;

}default:

return 0;

}return 0;

}char *righttrim(char *str)

--s;

while (s >= str)

else

}* (s + 1) = 0;

return str;

}void getaccname(char accname)

i = 0;

}memcpy(accname, caccname, 9);

}void getaccpwd(char accpwd)

i = 0;

}memcpy(accpwd, caccpwd, 7);

}double getcash(int flag)

scanf("%lf",&dcash);

fflush(stdin);

sprintf(ccash,"%12.2f",dcash);

if(checkinput(2, ccash))

i = 0;

}return dcash;

}int getaccnumber(int flag)

scanf("%d",&iaccnumber);

fflush(stdin);

return iaccnumber;

}

學籍管理系統(C語言版)

設計乙個學籍管理系統,基本功能包括 1.輸入學生基本資訊 2.查詢學生資訊 1.按學號2.按姓名 3.刪除學生資訊 1.按學號2.按姓名 4.學生資訊排序 1.按學號2.按姓名 5.修改學生基本資訊 6.輸出學生資訊 7.儲存學生資訊 0.退出程式 注 由於知識有限,該系統暫時規定只輸入3個學生資料...

學生管理系統C語言版

本程式若執行失敗請關閉重試,若再次失敗可以自行先建立乙個資料夾 d 000 studentinfo.txt 邊學鍊錶,結構體,指標邊做的程式,加起來學做了48小時,所以肯定存在很多不足,這是第二版,請多包含。define crt secure no warnings include include ...

C語言版掃雷

用c語言實現掃雷,首先應該有基本的思路,建立兩個相同大小的陣列,乙個用於布雷 初始化為全0,布雷時將雷置為1 另乙個給使用者展示 初始化為星號,使用者輸入座標後統計周圍雷的分布並列印雷的個數 由於需要統計每個座標周圍類的個數,所以將陣列建立大一圈,以方便統計。若輸了,列印出雷陣告訴玩家雷的分布。具體...