11_36.cpp

来自「10个比较经典的C++程序。初学者就先多学习学习别人吧。」· C++ 代码 · 共 21 行

CPP
21
字号
#include "book.h"
void main( )
{	OperBook ob;		int choice;
	fstream iofile("booksFile.bin",ios::binary|ios::in|ios::out );
	if (! iofile)	{  cerr << "Cannot open File!" << endl;       return;	}
   	while ( 1 )
   	{	cout<<"************BookStore Management system***********\n"
         << "1 :append \t2 :sale \t3 : inquire \t4 :createtxt \t0 :exit >> ";
	   	cin >> choice;
	   	switch ( choice )
	   	{ case 1 : ob.Append(iofile); break;
	   	  case 2 : ob.Sale(iofile); break;
	   	  case 3 : ob.Inquire(iofile); break;
	   	  case 4 : ob.CreateTxt(iofile); break;
	   	  case 0 : cout << " Exit system \n" ; return;
	   	  default : cout << "Input error occur!\n";
	   	}
   }
   iofile.close() ; 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?