在线等待银行内部信息系统 源代码

asdzzyy 2005-02-27 10:17:43
银行内部信息系统
编一个 客户管理,帐户,借款的系统
这个系统必须能够储存大量的客户,每个客户能够开一个或多个帐户,
但是每个帐户都必须用唯一的识别系统才能打开。
下面是对这个程序的一些要求
注册一个新客户,需要储存的一些基本资料哈,
比如名字,家庭地址,电话号码和一些另外的资料
(现行的身份证明,财务状况《上班或者失业》)
2) 添加,修改,拴除现存的客户。改变一个帐号的状态
(比如,冻结,不经常用的,顺差大的帐号)
3) 存款进一个帐户,要记录下面的一些情况
(时间,数目,存款的形式,《现金,支票还是转帐》)
4) 收回一个帐号,记录所以清楚的资料
5)向客户提供借款服务
6)能够在2个帐户之间转帐,还要记录开始和结束的时间,帐户号码
7)统计银行所以的客户,比如客户数量,帐号数量,平均每个人有多少个帐户,每个帐户平均多少钱,
每个帐户的借款情况,和银行一共的借款数目
哪位大虾帮帮忙啊
...全文
207 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Xyray 2005-02-27
  • 打赏
  • 举报
回复
/* 补上创建数据的程序 自己可以整合一下子
Creating a random-access file sequentially */
#include <stdio.h>

/* clientData structure definition */
struct clientData {
int acctNum; /* account number */
char lastName[ 15 ]; /* account last name */
char firstName[ 10 ]; /* account first name */
double balance; /* account balance */
}; /* end structure clientData */

int main()
{
int i; /* counter used to count from 1-100 */

/* create clientData with default information */
struct clientData blankClient = { 0, "", "", 0.0 };

FILE *cfPtr; /* credit.dat file pointer */

/* fopen opens the file; exits if file cannot be opened */
if ( ( cfPtr = fopen( "credit.dat", "wb" ) ) == NULL ) {
printf( "File could not be opened.\n" );
} /* end if */
else {

/* output 100 blank records to file */
for ( i = 1; i <= 100; i++ ) {
fwrite( &blankClient, sizeof( struct clientData ), 1, cfPtr );
} /* end for */

fclose ( cfPtr ); /* fclose closes the file */
} /* end else */

return 0; /* indicates successful termination */

} /* end main */
asdzzyy 2005-02-27
  • 打赏
  • 举报
回复
Xyray(恶之华)
运行的时候少了个数据文件呢是不是少了个啊
asdzzyy 2005-02-27
  • 打赏
  • 举报
回复
谢谢各位兄弟只是老师布置的作业
Xyray 2005-02-27
  • 打赏
  • 举报
回复
那确实 以上只是简单的单机事务处理
pkd 2005-02-27
  • 打赏
  • 举报
回复
还有,作为一个银行,不可能只有一个站点,所以还要考虑分布式的数据处理,与别的站点接口如何?
pkd 2005-02-27
  • 打赏
  • 举报
回复
典型的数据库编程啦,作为银行系统,数据库应该用现有的,没得选择。
如果是作为一个新开发的系统,数据库可以用MSSQL或者MYSQL或者ORICAL。
要实现所列的功能还是比较简单的。主要是数据库方面的存储和运行的优化。
Xyray 2005-02-27
  • 打赏
  • 举报
回复
//continue..

/* update balance in record */
void updateRecord( FILE *fPtr )
{
int account; /* account number */
double transaction; /* transaction amount */

/* create clientData with no information */
struct clientData client = { 0, "", "", 0.0 };

/* obtain number of account to update */
printf( "Enter account to update ( 1 - 100 ): " );
scanf( "%d", &account );

/* move file pointer to correct record in file */
fseek( fPtr, ( account - 1 ) * sizeof( struct clientData ),
SEEK_SET );

/* read record from file */
fread( &client, sizeof( struct clientData ), 1, fPtr );

/* display error if account does not exist */
if ( client.acctNum == 0 ) {
printf( "Acount #%d has no information.\n", account );
} /* end if */
else { /* update record */
printf( "%-6d%-16s%-11s%10.2f\n\n",
client.acctNum, client.lastName,
client.firstName, client.balance );

/* request transaction amount from user */
printf( "Enter charge ( + ) or payment ( - ): " );
scanf( "%lf", &transaction );
client.balance += transaction; /* update record balance */

printf( "%-6d%-16s%-11s%10.2f\n",
client.acctNum, client.lastName,
client.firstName, client.balance );

/* move file pointer to correct record in file */
fseek( fPtr, ( account - 1 ) * sizeof( struct clientData ),
SEEK_SET );

/* write updated record over old record in file */
fwrite( &client, sizeof( struct clientData ), 1, fPtr );
} /* end else */

} /* end function updateRecord */

/* delete an existing record */
void deleteRecord( FILE *fPtr )
{

struct clientData client; /* stores record read from file */
struct clientData blankClient = { 0, "", "", 0 }; /* blank client */

int accountNum; /* account number */

/* obtain number of account to delete */
printf( "Enter account number to delete ( 1 - 100 ): " );
scanf( "%d", &accountNum );

/* move file pointer to correct record in file */
fseek( fPtr, ( accountNum - 1 ) * sizeof( struct clientData ),
SEEK_SET );

/* read record from file */
fread( &client, sizeof( struct clientData ), 1, fPtr );

/* display error if record does not exist */
if ( client.acctNum == 0 ) {
printf( "Account %d does not exist.\n", accountNum );
} /* end if */
else { /* delete record */

/* move file pointer to correct record in file */
fseek( fPtr, ( accountNum - 1 ) * sizeof( struct clientData ),
SEEK_SET );

/* replace existing record with blank record */
fwrite( &blankClient,
sizeof( struct clientData ), 1, fPtr );
} /* end else */

} /* end function deleteRecord */

/* create and insert record */
void newRecord( FILE *fPtr )
{
/* create clientData with default information */
struct clientData client = { 0, "", "", 0.0 };

int accountNum; /* account number */

/* obtain number of account to create */
printf( "Enter new account number ( 1 - 100 ): " );
scanf( "%d", &accountNum );

/* move file pointer to correct record in file */
fseek( fPtr, ( accountNum - 1 ) * sizeof( struct clientData ),
SEEK_SET );

/* read record from file */
fread( &client, sizeof( struct clientData ), 1, fPtr );

/* display error if account already exists */
if ( client.acctNum != 0 ) {
printf( "Account #%d already contains information.\n",
client.acctNum );
} /* end if */
else { /* create record */

/* user enters last name, first name and balance */
printf( "Enter lastname, firstname, balance\n? " );
scanf( "%s%s%lf", &client.lastName, &client.firstName,
&client.balance );

client.acctNum = accountNum;

/* move file pointer to correct record in file */
fseek( fPtr, ( client.acctNum - 1 ) *
sizeof( struct clientData ), SEEK_SET );

/* insert record in file */
fwrite( &client,
sizeof( struct clientData ), 1, fPtr );
} /* end else */

} /* end function newRecord */

/* enable user to input menu choice */
int enterChoice( void )
{
int menuChoice; /* variable to store user's choice */

/* display available options */
printf( "\nEnter your choice\n"
"1 - store a formatted text file of acounts called\n"
" \"accounts.txt\" for printing\n"
"2 - update an account\n"
"3 - add a new account\n"
"4 - delete an account\n"
"5 - end program\n? " );

scanf( "%d", &menuChoice ); /* receive choice from user */

return menuChoice;

} /* end function enterChoice */


//The End

Xyray 2005-02-27
  • 打赏
  • 举报
回复
/* 估计程序功能不足,供参考,引自 Deitel 的C/C++/Java how 2 programming*/

/*
This program reads a random access file sequentially, updates data
already written to the file, creates new data to be placed in the
file, and deletes data previously in the file. */
#include <stdio.h>

/* clientData structure definition */
struct clientData {
int acctNum; /* account number */
char lastName[ 15 ]; /* account last name */
char firstName[ 10 ]; /* account first name */
double balance; /* account balance */
}; /* end structure clientData */

/* prototypes */
int enterChoice( void );
void textFile( FILE *readPtr );
void updateRecord( FILE *fPtr );
void newRecord( FILE *fPtr );
void deleteRecord( FILE *fPtr );

int main()
{
FILE *cfPtr; /* credit.dat file pointer */
int choice; /* user's choice */

/* fopen opens the file; exits if file cannot be opened */
if ( ( cfPtr = fopen( "credit.dat", "rb+" ) ) == NULL ) {
printf( "File could not be opened.\n" );
} /* end if */
else {

/* enable user to specify action */
while ( ( choice = enterChoice() ) != 5 ) {

switch ( choice ) {

/* create text file from record file */
case 1:
textFile( cfPtr );
break;

/* update record */
case 2:
updateRecord( cfPtr );
break;

/* create record */
case 3:
newRecord( cfPtr );
break;

/* delete existing record */
case 4:
deleteRecord( cfPtr );
break;

/* display message if user does not select valid choice */
default:
printf( "Incorrect choice\n" );
break;

} /* end switch */

} /* end while */

fclose( cfPtr ); /* fclose closes the file */
} /* end else */

return 0; /* indicates successful termination */

} /* end main */

/* create formatted text file for printing */
void textFile( FILE *readPtr )
{
FILE *writePtr; /* accounts.txt file pointer */

/* create clientData with default information */
struct clientData client = { 0, "", "", 0.0 };

/* fopen opens the file; exits if file cannot be opened */
if ( ( writePtr = fopen( "accounts.txt", "w" ) ) == NULL ) {
printf( "File could not be opened.\n" );
} /* end if */
else {
rewind( readPtr ); /* sets pointer to beginning of file */
fprintf( writePtr, "%-6s%-16s%-11s%10s\n",
"Acct", "Last Name", "First Name","Balance" );

/* copy all records from random-access file into text file */
while ( !feof( readPtr ) ) {
fread( &client, sizeof( struct clientData ), 1, readPtr );

/* write single record to text file */
if ( client.acctNum != 0 ) {
fprintf( writePtr, "%-6d%-16s%-11s%10.2f\n",
client.acctNum, client.lastName,
client.firstName, client.balance );
} /* end if */

} /* end while */

fclose( writePtr ); /* fclose closes the file */
} /* end else */

} /* end function textFile */

linquan88 2005-02-27
  • 打赏
  • 举报
回复
呵呵 ...........

那个银行用?

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧