⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zoomain.cpp

📁 通过类型姓名年龄类别来显示动物
💻 CPP
📖 第 1 页 / 共 2 页
字号:

    // Give waring if there is no Animal to move 
	if ( MyZoo.CountAnimals() == 0 )

	{
		Warning ( "Nothing To Move !" );    // The warning
		return;
	}

	// ask the user to enter the cage number where he/she wishes to move
	// the Animal
	cout<<"\nEnter The Cage Number\nFrom Where You Want To Move An Animal :";
	cin>>cage;                        // Enter the cage number
	clrscr();                         // Clear screen function
	cout<<"\t\tData Of Animals In Cage <"<<cage<<">\n\n";
	// Display the Animals in the cage requested
	MyZoo.DisplayViaCage( cage );
	cout<<"Enter The Animal Number You Wish To Move :";
	cin>>number;                // Enter the Animal number to move
	anim = MyZoo.RemoveAnimalViaNumber ( number, FALSE );
	if ( anim == NULL )// give warning if the number is not existing

	{
		Warning ( "There Is No Such Animal !");
		return;
	}

	clrscr();
	cout<<"\t\tMoving Animal\n\n";
	anim->Display();	                      // displaying current info
	cout<<"\nEnter Destination Cage Number :";// Enter the cage you choose
	cin>>cage; // the cage number for the Animal you moved                    
	anim->SetCage(cage);	                  // changing cage number
	MyZoo.AddAnimal( anim );                  // Returning it back to the Zoo
	clrscr();                                 // Call clear screen func
	cout<<"\t\tAnimal Was Moved !\n\n";       // Display a message to the user
	anim->Display();                          // Display current info
	Warning();                                // Give warning
}

void DisplayTotals( void )

{
	clrscr();                         // Clear screen function
	cout<<"\n\t\t\tTotal Animals In The Research Zoo.\n\n";  // Title
	// Total of Bears
    cout<<"\t\t\tTotal Bears   : " <<MyZoo.CountAnimals(BEAR_ID)<<endl;
    // Total of Tigera
    cout<<"\t\t\tTotal Tigers  : " <<MyZoo.CountAnimals(TIGER_ID)<<endl;
    // Total of Lions
	cout<<"\t\t\tTotal Lions   : " <<MyZoo.CountAnimals(LION_ID)<<endl;
    // Total of Wolves
	cout<<"\t\t\tTotal Wolves  : " <<MyZoo.CountAnimals(WOLVE_ID)<<endl;
	// Total of Coyotes
	cout<<"\t\t\tTotal Coyotes : " <<MyZoo.CountAnimals(COYOTE_ID)<<endl;
	// Total of WildCats
	cout<<"\t\t\tTotal WildCat : " <<MyZoo.CountAnimals(WILDCAT_ID)<<endl;
	// Total of Leopard
	cout<<"\t\t\tTotal Leopard : " <<MyZoo.CountAnimals(LEOPARD_ID)<<endl;
	// Total of Foxes
	cout<<"\t\t\tTotal Foxes   : " <<MyZoo.CountAnimals(FOX_ID)<<endl;
	// Total of Dogs
    cout<<"\t\t\tTotal Dogs    : " <<MyZoo.CountAnimals(DOGS_ID)<<endl;
    // Display the Total of All Animals
	cout<<"\t\t\t----------------------\n\t\t\tTotal Animals : " <<
		MyZoo.CountAnimals(GENERIC_ANIMAL_ID)<<endl; // Grand Total
	Warning();

}


void InfoAboutAnim(void)
{
	
	clrscr();
	cout<<"\t\t|-----------------------------------------|\n";
	cout<<"\t\t|   Infomation About Canines And Filines  |\n";
	cout<<"\t\t|-----------------------------------------|\n";
	
	cout<<"\n      Canines: All mammals have a single canine in each quadrant,";
	cout<<"if they have canines at all. These teeth are often absent; "; 
	cout<<"they are never found in modern rodents, for example, and many ";
	cout<<"artiodactyls have them only in the lower jaw. When present, the ";
	cout<<"canines are the first tooth in the maxilla. They tend to be moderately ";
	cout<<"to very long, and most commonly they consist of a single cusp with one ";
	cout<<"root. Canines are most often used for stabbing and holding prey, and it ";
	cout<<"is in herbivorous species that they are often reduced in size or missing altogether";
	cout<<endl;

	cout<<"      Filenes: Above all it is important to remember that cat is a carnivore ";
	cout<<"and requires a meat diet. This apparently self-obvious fact is all too ";
	cout<<"often overlooked by people who, all well meaning, attempt to make an ";
	cout<<"omnivore or herbivore out-of their pet. They are slowly killing the ";
	cout<<"animal with love.\n";

    cout<<"Cats, despite 5000 years of domestication, remain strictly";
    cout<<"carnivorous. They are incapable of digesting and receiving nutrition";
    cout<<"from the majority of vegetable proteins. There are no and can be no";
    cout<<"vegetarian cats. In addition, cats in the wild are equal-opportunity";
    cout<<"carnivores and devour the whole of their prey:muscles, organs,";
    cout<<"viscera, bones, offal, skin, etc. In this manner, cats ingest not";
    cout<<"only  the flesh and organs of their prey but also the partially and";
    cout<<"wholly digested vegetable foods the prey had eaten. With the assist-";
    cout<<"ance of the prey's own digestive processes, the cat then is able to";
    cout<<"derive nutrition from various vegetable sources.\n";
	Warning();
	clrscr();
	cout<<"      Canines: All mammals have a single canine in each quadrant,";
	cout<<"if they have canines at all. These teeth are often absent; "; 
	cout<<"they are never found in modern rodents, for example, and many ";
	cout<<"artiodactyls have them only in the lower jaw. When present, the ";
	cout<<"canines are the first tooth in the maxilla. They tend to be moderately ";
	cout<<"to very long, and most commonly they consist of a single cusp with one ";
	cout<<"root. Canines are most often used for stabbing and holding prey, and it ";
	cout<<"is in herbivorous species that they are often reduced in size or missing altogether\n";
    cout<<"      Filenes: Above all it is important to remember that cat is a carnivore ";
	cout<<"and requires a meat diet. This apparently self-obvious fact is all too ";
	cout<<"often overlooked by people who, all well meaning, attempt to make an ";
	cout<<"omnivore or herbivore out-of their pet. They are slowly killing the ";
	cout<<"animal with love.\n";

    cout<<"Cats, despite 5000 years of domestication, remain strictly";
    cout<<"carnivorous. They are incapable of digesting and receiving nutrition";
    cout<<"from the majority of vegetable proteins. There are no and can be no";
    cout<<"vegetarian cats. In addition, cats in the wild are equal-opportunity";
    cout<<"carnivores and devour the whole of their prey:muscles, organs,";
    cout<<"viscera, bones, offal, skin, etc. In this manner, cats ingest not";
    cout<<"only  the flesh and organs of their prey but also the partially and";
    cout<<"wholly digested vegetable foods the prey had eaten. With the assist-";
    cout<<"ance of the prey's own digestive processes, the cat then is able to";
    cout<<"derive nutrition from various vegetable sources."<<endl;
	Warning();
	clrscr();
}

void GetHelp(void)
{
	clrscr();
	cout<<"\t\t   Help To Browse The Research Zoo Menu  \n";
	cout<<"\t\t-----------------------------------------\n";
	cout<<"The Main Menu Give you: \t\t\tThe Animals In The Zoo:\n";
	cout<<"1. Add An Animal\t\t\t\t1. Bear\n";
	cout<<"2. Delete An Animal\t\t\t\t2. Tiger\n";
	cout<<"3. Display Animal By Type\t\t\t3. Lion\n";
	cout<<"4. Display Animal By Cage\t\t\t4. Wolves\n";
	cout<<"5. Increment Animal Age\t\t\t\t5. Coyote\n";
	cout<<"6. Add The Total Animal\t\t\t\t6. WildCat\n";
	cout<<"7. Total Animals In Zoo\t\t\t\t7. Leopard\n";
	cout<<"8. Info About Canines & Felines\t\t\t8. Fox\n";
	cout<<"9. Help Screen\t\t\t\t\t9. Doges\n";
	cout<<"\t_____________________________________________________\n";
	cout<<"\t| this research Zoo contain only two kind of animals:|\n";
	cout<<"\t| CANNINES and FELINES for the science purpose.      |\n";
	cout<<"\t| By choosing the option, you can got the result of  |\n";
	cout<<"\t| Adding animals, Displaying them All or by kind, You|\n";
	cout<<"\t| can remore animal or move animal from cage to cage |\n";
	cout<<"\t| upon the request of user, all animals are having   |\n";
	cout<<"\t| unique number which the computer assigned for them,|\n";
	cout<<"\t| also when the animal grow, the user can increment  |\n";
	cout<<"\t| the age by one year.                               |\n";
	cout<<"\t|____________________________________________________|\n";

	Warning();
	clrscr();
}

//************************************************************************

// To display the main menu for the Researchers

int main ()

{

 char * MainMenuStr[] = { " Add Animal to The Zoo", 
                          " Remove Animal From Zoo",
						  " Display Animals By Type",
						  " Display Animals By Cage",
						  " Increment Animal's Age",
						  " Move Animal From The Cage",
						  " Total Of Animals In Zoo",
						  " Canines & Filines Informations",
						  " Help Screen",
						  "Exit Program" };  // Display the Menu choices
 

   Menu MainMenu ( "\n\t\t\tAnimal's Zoo Main Menu \n \t\t\tResearch Centre For Science\n \t\t\tof Canines & Felines Animal\n", MainMenuStr, 10);
	int choice;
	do

	{
	 choice = MainMenu.MakeChoice();    // Make choice function

	 switch ( choice )                 // Switch statement

	 {

	 case 0:                            // Add animal(s)
         AddAnimals( );
		 break;

	 case 1:                            // Delete animal(s)
		 DeleteAnimals();
		 break;

	 case 2:	                        // Display animal(s)
		 DisplayAnimalsByType( );
		 break;

	 case 3:	                        // Display animal(s)
		 DisplayAnimalsByCage( );       // Display Animal(s) by cage
		 break;

	 case 4:
		 IncrementAge( );               // Increment Age func
		 break;

	 case 5:	                        
		 MoveAnimal( );                 // Move Animal(s)from cage to cage
		 break;

	 case 6:	                        
		 DisplayTotals( );              // Display Total of animals 
		 break;

	 case 7:
		 InfoAboutAnim( );
		 break;

	case 8:
		 GetHelp( );
		 break;

	 }

	} while ( choice != -1 && choice != 9 ); // Get choices

	return 0;
}

//************************************************************************

⌨️ 快捷键说明

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