| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 593 人关注过本帖
标题:程序出错拉,求助,无解啊
只看楼主 加入收藏
shock0808
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2007-1-13
收藏
 问题点数:0 回复次数:2 
程序出错拉,求助,无解啊

#include"iostream.h"
#include"iomanip.h"
#include"string.h"
#include"stdlib.h"
#include"fstream.h"
#define N 1000000000
class bank
{
protected:
struct node
{
int account;
int mima;
float money;
}fn[N];
public:
bank()
{ int i;
fstream file("bank.txt",ios::in);
while(1)
{ for(i=0;i<=N;i++)
{
file.read((char *)&fn[i].account,sizeof(fn[i].account));
file.read((char *)&fn[i].mima,sizeof(fn[i].mima));
file.read((char *)&fn[i].money,sizeof(fn[i].money));
if(!file) break;
}
}
file.close();
}
void newaccount()//新建帐户
{
int i,b,bb;float c;
for(i=0;i<=N;i++)
{
cout<<"Please input the mima:"<<endl;
cin>>bb;
cout<<"Please input the mima again:"<<endl;
cin>>b;
cout<<"Please input the startmoney:"<<endl;
cin>>c;
if(bb!=b) cout<<"The mima is error!"<<endl;
else{
fn[i++].account;
fn[i].mima=b;
fn[i].money=c;
}
}
}
void findaccount()///查找
{
int a,b,bb,i;
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a;
if(a!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima:"<<endl;
cin>>bb;
cout<<"Please input the mima again:"<<endl;
cin>>b;
if(b!=bb||b!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<setw(10)<<"account"<<setw(10)<<"leftmoney"<<endl;
cout<<setw(10)<<fn[i].account<<setw(10)<<fn[i].money<<endl;
}
}

}
}
void changmima()//修改密码
{
int a,b1,bb1,bb2,b2,i;
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a;
if(a!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima:"<<endl;
cin>>bb1;
cout<<"Please input the mima again:"<<endl;
cin>>b1;
if(b1!=bb1||b1!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<"Please input the newmima:"<<endl;
cin>>bb2;
cout<<"Please input the newmima again:"<<endl;
cin>>b2;
if(bb2!=b2) cout<<"The mima is error!"<<endl;
else fn[i].mima=b2;
}
}
}
}
void inmoney()//存款
{
int a,b,bb,i;float c;
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a;
if(a!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima"<<endl;
cin>>bb;
cout<<"Please input the mima again:"<<endl;
cin>>b;
if(bb!=b||b!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<"Please input the inmoney:"<<endl;
cin>>c;
fn[i].money+=c;
}
}
}
}
void outmoney()//取款
{
int a,b,bb,i;float c;
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a;
if(a!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima"<<endl;
cin>>bb;
cout<<"Please input the mima again:"<<endl;
cin>>b;
if(bb!=b||b!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<"Please input the outmoney:"<<endl;
cin>>c;
if(c>=fn[i].money) cout<<"Sorry! The money of account is little!"<<endl;
else fn[i].money-=c;
}
}
}
}
void zhuanmoney()//转帐
{
int a1,a2,b1,bb1,i;float c;
struct node fn_1[N];
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a1;
if(a1!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima:"<<endl;
cin>>bb1;
cout<<"Please input the mima again:"<<endl;
cin>>b1;
if(bb1!=b1||b1!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<"Please input the other account:"<<endl;
cin>>a2;
if(a2!=fn_1[i].account) cout<<"the account is error!"<<endl;
else
{cout<<"Please input the outmoney"<<endl;
cin>>c;
if(c>=fn[i].money) cout<<"Sorry,the money is little!"<<endl;
else
{
fn[i].money-=c;
fn_1[i].money+=c;
}
}
}
}
}
}
void quit()
{char tomenu;
cout<<"请按'q'或'Q'返回"<<endl; //返回主菜单提示
do{
cin>>tomenu;
}while(!(tomenu=='q'||tomenu=='Q'));return ;
}

~bank()
{
fstream file("bank.txt",ios::out);
for(int i=0;i<=N;i++)
if(fn[i].account==0&&fn[i].mima==0&&fn[i].money==0)
{
file.write((char *)&fn[i].account,sizeof(fn[i].account));
file.write((char *)&fn[i].mima,sizeof(fn[i].mima));
file.write((char *)&fn[i].money,sizeof(fn[i].money));
}
file.close();
}

};
void main()
{
bank f1;
int select;
while(1)
{
cout<<setw(5)<<"********************************************************************"<<endl;
cout<<setw(15)<<"欢迎使用3_209银行帐户管理系统!"<<endl;
cout<<setw(15)<<"(版权归209用户所有,禁止非法盗用,否则我们很生气,后果很严重!)"<<endl;
cout<<setw(5)<<"********************************************************************"<<endl;
cout<<"创建新帐户请选:1"<<endl<<"查帐请选:2"<<endl<<"存款请选:3"<<endl<<"取款请选:4"<<endl<<"转帐请选:5"<<"修改密码请选: 6"<<endl<<"退出请选: 7"<<endl;
do
{
cin>>select;
}while(select==1||select==2||select==3||select==4||select==5||select==6||select==7);
switch(select)
{
case '1':
f1.newaccount();break;
case '2':
f1.findaccount();break;
case '3':
f1.inmoney();break;
case '4':
f1.outmoney();break;
case '5':
f1.zhuanmoney();break;
case '6':
f1.changmima();break;
case '7':
f1.quit();
}

}
}
#include"iostream.h"
#include"iomanip.h"
#include"string.h"
#include"stdlib.h"
#include"fstream.h"
#define N 1000000000
class bank
{
protected:
struct node
{
int account;
int mima;
float money;
}fn[N];
public:
bank()
{ int i;
fstream file("bank.txt",ios::in);
while(1)
{ for(i=0;i<=N;i++)
{
file.read((char *)&fn[i].account,sizeof(fn[i].account));
file.read((char *)&fn[i].mima,sizeof(fn[i].mima));
file.read((char *)&fn[i].money,sizeof(fn[i].money));
if(!file) break;
}
}
file.close();
}
void newaccount()//新建帐户
{
int i,b,bb;float c;
for(i=0;i<=N;i++)
{
cout<<"Please input the mima:"<<endl;
cin>>bb;
cout<<"Please input the mima again:"<<endl;
cin>>b;
cout<<"Please input the startmoney:"<<endl;
cin>>c;
if(bb!=b) cout<<"The mima is error!"<<endl;
else{
fn[i++].account;
fn[i].mima=b;
fn[i].money=c;
}
}
}
void findaccount()///查找
{
int a,b,bb,i;
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a;
if(a!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima:"<<endl;
cin>>bb;
cout<<"Please input the mima again:"<<endl;
cin>>b;
if(b!=bb||b!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<setw(10)<<"account"<<setw(10)<<"leftmoney"<<endl;
cout<<setw(10)<<fn[i].account<<setw(10)<<fn[i].money<<endl;
}
}

}
}
void changmima()//修改密码
{
int a,b1,bb1,bb2,b2,i;
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a;
if(a!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima:"<<endl;
cin>>bb1;
cout<<"Please input the mima again:"<<endl;
cin>>b1;
if(b1!=bb1||b1!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<"Please input the newmima:"<<endl;
cin>>bb2;
cout<<"Please input the newmima again:"<<endl;
cin>>b2;
if(bb2!=b2) cout<<"The mima is error!"<<endl;
else fn[i].mima=b2;
}
}
}
}
void inmoney()//存款
{
int a,b,bb,i;float c;
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a;
if(a!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima"<<endl;
cin>>bb;
cout<<"Please input the mima again:"<<endl;
cin>>b;
if(bb!=b||b!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<"Please input the inmoney:"<<endl;
cin>>c;
fn[i].money+=c;
}
}
}
}
void outmoney()//取款
{
int a,b,bb,i;float c;
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a;
if(a!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima"<<endl;
cin>>bb;
cout<<"Please input the mima again:"<<endl;
cin>>b;
if(bb!=b||b!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<"Please input the outmoney:"<<endl;
cin>>c;
if(c>=fn[i].money) cout<<"Sorry! The money of account is little!"<<endl;
else fn[i].money-=c;
}
}
}
}
void zhuanmoney()//转帐
{
int a1,a2,b1,bb1,i;float c;
struct node fn_1[N];
for(i=0;i<=N;i++)
{
cout<<"Please input your account:"<<endl;
cin>>a1;
if(a1!=fn[i].account) cout<<"The account is error!"<<endl;
else
{
cout<<"Please input the mima:"<<endl;
cin>>bb1;
cout<<"Please input the mima again:"<<endl;
cin>>b1;
if(bb1!=b1||b1!=fn[i].mima) cout<<"The mima is error!"<<endl;
else
{
cout<<"Please input the other account:"<<endl;
cin>>a2;
if(a2!=fn_1[i].account) cout<<"the account is error!"<<endl;
else
{cout<<"Please input the outmoney"<<endl;
cin>>c;
if(c>=fn[i].money) cout<<"Sorry,the money is little!"<<endl;
else
{
fn[i].money-=c;
fn_1[i].money+=c;
}
}
}
}
}
}
void quit()
{char tomenu;
cout<<"请按'q'或'Q'返回"<<endl; //返回主菜单提示
do{
cin>>tomenu;
}while(!(tomenu=='q'||tomenu=='Q'));return ;
}

~bank()
{
fstream file("bank.txt",ios::out);
for(int i=0;i<=N;i++)
if(fn[i].account==0&&fn[i].mima==0&&fn[i].money==0)
{
file.write((char *)&fn[i].account,sizeof(fn[i].account));
file.write((char *)&fn[i].mima,sizeof(fn[i].mima));
file.write((char *)&fn[i].money,sizeof(fn[i].money));
}
file.close();
}

};
void main()
{
bank f1;
int select;
while(1)
{
cout<<setw(5)<<"********************************************************************"<<endl;
cout<<setw(15)<<"欢迎使用3_209银行帐户管理系统!"<<endl;
cout<<setw(15)<<"(版权归209用户所有,禁止非法盗用,否则我们很生气,后果很严重!)"<<endl;
cout<<setw(5)<<"********************************************************************"<<endl;
cout<<"创建新帐户请选:1"<<endl<<"查帐请选:2"<<endl<<"存款请选:3"<<endl<<"取款请选:4"<<endl<<"转帐请选:5"<<"修改密码请选: 6"<<endl<<"退出请选: 7"<<endl;
do
{
cin>>select;
}while(select==1||select==2||select==3||select==4||select==5||select==6||select==7);
switch(select)
{
case '1':
f1.newaccount();break;
case '2':
f1.findaccount();break;
case '3':
f1.inmoney();break;
case '4':
f1.outmoney();break;
case '5':
f1.zhuanmoney();break;
case '6':
f1.changmima();break;
case '7':
f1.quit();
}

}
}
出什么问题了..求助挖

搜索更多相关主题的帖子: account include public money 
2007-01-14 15:23
shock0808
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2007-1-13
收藏
得分:0 
...程序重复粘贴了。...不好意思挖..

2007-01-14 15:24
Alome
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2007-1-14
收藏
得分:0 
菜鸟来也!

不好意思哦~毫无头绪~呵呵~帮不了忙~
顶一下!

如果我也认为自己很懒,大概神也这么认为吧~!
2007-01-14 16:09
快速回复:程序出错拉,求助,无解啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.070131 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved