《虚拟银行》

来源:互联网 发布:专题片男生配音软件 编辑:程序博客网 时间:2024/04/20 06:53
 

简单程序:

//用户信息存储;

void cunpan()
{
 
 ofstream outfile("f1.dat",ios::out);//定义文件流对象,打开磁盘文件″f1.dat″
 if(!outfile)                        //如果打开失败,outfile返回0值
 {
  cerr<<"open error!"<<endl;
  exit(1);
 }
 for(int i1=0;i1<3;i1++)
  for(int i2=0;i2<2;i2++)
   outfile<<z[i1][i2]<<" ";            //向磁盘文件″f1.dat″输出数据
  outfile.close();
 
}

//得到用户信息;

void shuchu()
{
 ifstream infile("f1.dat",ios::in);
 if(!infile)
 {
  cerr<<"open error!"<<endl;
  exit(1);
 }
 for(int i1=0;i1<3;i1++)
  for(int i2=0;i2<2;i2++)
   infile>>z[i1][i2];           
  infile.close();
  
}

################################################################################################

原创粉丝点击