1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
// bears lions zebras gorrilas monkeys, oh my!
// A zoo class program using classes (duh) and
// inharitance
#include <iostream>
#include <string>
using namespace std;
string animalTypes[10]=
{
"Tiger",
"Elephant",
"", // have not come up with the rest of the animals yet, but
"", // irrelevant to this problem
"",
"",
"",
"",
"",
};
class Animal
{
public:
string name;
Animal(int n_type); // the constructer
protected:
int hunger;
bool sick;
int age;
int type; // this will be a number that will be used in animalType. i.e. a tiger would be 0
string nameoftype;
};
Animal::Animal(int n_type)
{
cout << "What would you like to name this " << animalTypes[n_type] << "?\n";
cin >> name;
system("cls");
age = 0;
type = n_type;
nameoftype = animalTypes[n_type];
cout << "The animal " << name << " of type " << nameoftype << " has been created\n";
system("pause");
system("cls");
}
class Zoo
{
public:
string name;
Zoo(int a);
int money;
int moneyGoal;
private:
int nAnimals;
int maxAnimals;
};
Zoo::Zoo(int a)
{
cout << "Welcome to the Virtual Zoo Simulation! In this quasi-game, you must\n";
cout << "raise and take care of various zoo animals in order to sell them to other\n";
cout << "zoos and make money! You start with $300 dollers. Try to make $10,000!\n";
cout << "Have fun!\n";
moneyGoal = 10000;
maxAnimals = 25;
}
int main()
{
Zoo myzoo(0);
/* stuff not needed right now
Animal *Animals[25]={};
string stripes = "Stripes";
Animals[0] = new Animal(0);
cout << "Everyone welcome " << Animals[0]->name << " to the zoo!\n";
delete Animals[0];
cout << "Stripes has been deleted!";
*/
return 0;
}
|