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
|
#include "rabbit.h"
#include <iostream>
#include <ctime>
#include <string>
#include <cstdlib>
using namespace std;
rabbit::rabbit(int r,int p)
{
sex;
volvol = r%2;
if (volvol>0){
sex = true;
rabbitSex= "male";
}
else{
sex= false;
rabbitSex = "female";
}
cout<<"rabbit "<<p<<endl<<" sex: "<< rabbitSex << endl;
c = r%21;
string rabbitName[21] = {"Steve", "Tom", "Rabi" , "Lorence", "Carrrot", "AssJucie","Nick","Israel","Noal","Hen","Keany","Lolo","Choclte","Nor","Lili","Kely","Nofar","Matilda","Igor","Joel","Nimrod",};
name = rabbitName[c];
cout <<" name: "<< name << endl;
int g = r%100;
if (g<2){
mutantRabbit = false;
cout << "Bahhh im a mutant!!! "<< endl;
}
if(p<6){
i = r%4;
string rabbitColor[4]= {"white", "brown", "black", "spotted"};
color = rabbitColor[i];
cout <<" color: "<<color<<endl;
}
int rabbitAge[11];
for(int m =0;m<11;m++){
rabbitAge[m]=m;
}
if(p<6){ b = r%11;
age = rabbitAge[b];
cout << " age: "<< age<< endl<<endl<<endl;
}
}
void rabbit::ageing(){
age++;
cout<<"rabbit "<<name<<" is now "<<age<< " years old."<<endl<<endl;
}
void rabbit::info(){
cout<<endl<<name<<endl<<endl<<"age: "<<age<<endl<<"color: "<<color<<endl<<"sex: ";
if(sex==true){
cout<<"male"<<endl;
}
if(sex==false){
cout<<"female"<<endl;
}
if(mutantRabbit==false){
cout<<"mutant rabit"<<endl;
}
cout<<endl<<endl;
}
rabbit::~rabbit()
{
}
|