{ cout<<"第"<snakes[n].ShowMe(); } cout<}
void count() { cout<<"笼子里的猫总共有:"<cout<<"笼子里的狗总共有:"<cout<<"笼子里的蛇总共有:"<cout<} };
void main() { char c; Cat cat; Dog dog; Snake snake; Shelves shelves; int i=1,j;
cout<<"这是关于往笼子里放动物的问题: "<cout<cout<<" 1: 往笼子里放猫;"<cout<<" 2: 往笼子里放狗;"<cout<<" 3: 往笼子里放蛇;"<cout<<" 4: 查询笼子里的动物;"<cout<<" 5: 删除笼子里的动物;"<cout<<" 6:统计笼子里的动物种类及数量;"<cout<<" 7: 退出程序;"<cout<<"------------------------------------------"<while(i) { cout<<"请选择您的*作:"; cin>>i; switch(i) { case 1: cout<<" 往哪只笼子里面放: "; cin>>j; cin>>cat; while (shelves.push_cat(cat, j)==0) { cout<<" 笼子里已有动物,请换一个笼子: "; cin>>j; } break; case 2: cout<<" 往哪只笼子里面放: "; cin>>j; cin>>dog; while (shelves.push_dog(dog, j)==0) { cout<<" 笼子里已有动物,请换一个笼子: "; cin>>j; } break; case 3: cout<<" 往哪只笼子里面放: "; cin>>j; cin>>snake; while (shelves.push_snake(snake, j)==0) { cout<<" 笼子里已有动物,请换一个笼子: "; cin>>j; } break; case 4: cout<<" 查询哪只笼子: "; cin>>j; shelves.seek(j); break; case 5: cout<<" 删除哪只笼子里的动物: "; cin>>j; shelves.del(j); break; case 6: shelves.count(); break; default: i=0; break; } cout<} } |