Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2341299
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:07:40

#include "iostream"
using namespace std;
const int n=5;
void he();
class BOOK{
      public:
      string name;
      string author;
      string state;
      int ID;
      float price;
      int po;
      BOOK()
      {    
            ID=0;
            name="null";
            author=" ";
            state="在馆";
            price=0;
            po=0;
            }
void addbook()
{    
             
             cout<<"请输入书名:";
             cin>>name;
             cout<<"请输入作者:";
             cin>>author;
             cout<<"请输入书价格:";
             cin>>price;
             }
void findbook()
{  
for(int i=po;i{     po++;
      if(name=="null")
{
cout<<"是否~继续添加Y/N?";
char t;
cin>>t;
 if(t=='Y'||'y')
         {
         addbook();
         ID++;
         }
 if(t=='N'||'n')
{ break;}
}
 if(name!="null")    
 { cout<<"书位已经满了"<   break;
      }
      }
      }

void sharebook()
{
cout<cout<cout<cout<}
                   
            };BOOK book[n];
int main()
{
    he();
     cout<<"现有图书:"<       cout<<"书号"<<"\t";
      cout<<"书名"<<"\t";
     cout<<"作者"<<"\t";
    cout<<"价格"<<"\t"<for(int i=0;i{
       
    book[i].sharebook();
}

    system("pause");
}

void he()
{

    int m;
    char o;
    int out=1;
    while(out)
    {
       cout<<"添加图书输入Y/或查询现有图书输入N?";
       cin>>o;
    if(o=='y'||o=='Y')
    {  m=0;
       book[m].findbook();
       m++;
       }
    if(o=='N'||o=='n')
    out=0;
}
}


--------------------next---------------------
#include "iostream"
using namespace std;
const int n=5;
void he();
class BOOK{
      public:
      string name;
      string author;
      string state;
      int ID;
      float price;
      int po;
      BOOK()
      {    
            ID=0;
            name="null";
            author=" ";
            state="在馆";
            price=0;
            po=0;
            }
void addbook()
{    
             
             cout<<"请输入书名:";
             cin>>name;
             cout<<"请输入作者:";
             cin>>author;
             cout<<"请输入书价格:";
             cin>>price;
             }
void findbook()
{  
for(int i=po;i{     po++;
      if(name=="null")
{
cout<<"是否~继续添加Y/N?";
char t;
cin>>t;
 if(t=='Y'||'y')
         {
         addbook();
         ID++;
         }
 if(t=='N'||'n')
{ break;}
}
 if(name!="null")    
 { cout<<"书位已经满了"<   break;
      }
      }
      }

void sharebook()
{
cout<cout<cout<cout<}
                   
            };BOOK book[n];
int main()
{
    he();
     cout<<"现有图书:"<       cout<<"书号"<<"\t";
      cout<<"书名"<<"\t";
     cout<<"作者"<<"\t";
    cout<<"价格"<<"\t"<for(int i=0;i{
       
    book[i].sharebook();
}

    system("pause");
}

void he()
{

    int m;
    char o;
    int out=1;
    while(out)
    {
       cout<<"添加图书输入Y/或查询现有图书输入N?";
       cin>>o;
    if(o=='y'||o=='Y')
    {  m=0;
       book[m].findbook();
       m++;
       }
    if(o=='N'||o=='n')
    out=0;
}
}


--------------------next---------------------

阅读(1050) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~