I have a default constructor in the base class...and it still doesn't work. I'm just going to post my ENTIRE source code for this because I'm bumming and I don't see what is wrong....it is more than likely simple and I will feel silly for not noticing it
Code:
//This is the human program
//The class is class human
//Here is a list of different attritutes to be included:
/*
physical attributes
[pa]
Hair color, eye color, height, weight, skin color,
*/
//I want to create parents. And then each human will have two parent humans
//Each attribute needs to be mostly affected by the two parent's attributes, but also by chance
//
#include <windows.h>
#include <iostream>
#include <string>
#include <conio.h>
#include <time.h>
#include <fstream>
using namespace std;
ofstream fout; //used for outputting all of the data
class Parent{
public:
Parent(string Name);
//static void Randomize(void) {srand(GetTickCount());}
void Synopsis();
void OutPutData();
protected:
//physical attributes
string Name;
int SkinColor,
HairColor,
EyeColor,
Height,
Weight,
Intelligence,
Temper,
SelfEsteem,
Reasonableness;
};
Parent::Parent(string name) {
Name = name;
SkinColor = rand()%5;
HairColor = rand()%5;
EyeColor = rand()%5;
Height = (rand()%36) + 36; //mexico sucks
Weight = (rand()%200) + 70;
Intelligence = rand()%5;
};
void Parent::OutPutData() {
fout << endl;
fout << "Here are the attributes for " << Name << endl;
cout << "Here are the attributes for " << Name << endl;
fout << "SkinColor " << SkinColor << endl;
cout << "SkinColor " << SkinColor << endl;
fout << "HairColor " << HairColor << endl;
cout << "HairColor " << HairColor << endl;
fout << "EyeColor " << EyeColor << endl;
cout << "EyeColor " << EyeColor << endl;
fout << "Weight " << Weight << " pounds " << endl;
cout << "Weight " << Weight << " pounds " << endl;
fout << "Height " << Height << " inches," << (Height/12) << " feet" << endl;
cout << "Height " << Height << " inches," << (Height/12) << " feet" << endl;
fout << "Intelligence " << Intelligence << endl;
cout << "Intelligence " << Intelligence << endl;
fout << endl;
};
void Parent::Synopsis() {
switch(SkinColor) {
case 0:
{
cout << Name << " has a very light skin color" << endl;
break;
}
case 1:
{
cout << Name << " has a light skin color" << endl;
break;
}
case 2:
{
cout << Name << " has a somewhat light skin color" << endl;
break;
}
case 3:
{
cout << Name << " has a somewhat dark skin color" << endl;
break;
}
case 4:
{
cout << Name << " has a dark skin color" << endl;
break;
}
case 5:
{
cout << Name << " has a very dark skin color" << endl;
break;
}
default:
{
cout << "I honestly don't know how you got her, but somehow you did, and you suck for it" << endl;
}
}
}
class Human : public Parent {
public:
private:
};
int main(void) {
fout.open("Generated.txt");
srand(GetTickCount());
Human Charles("Charles");
Human Jessica("Jessica");
Human Bob("Bob");
Human Frank("Frank");
Human Emmy("Emmy");
Human Rachel("Rachel");
Charles.OutPutData();
Charles.Synopsis();
getch();
system("cls");
Jessica.OutPutData();
Jessica.Synopsis();
getch();
system("cls");
Bob.OutPutData();
Bob.Synopsis();
getch();
system("cls");
Frank.OutPutData();
Frank.Synopsis();
getch();
system("cls");
Emmy.OutPutData();
Emmy.Synopsis();
getch();
system("cls");
Rachel.OutPutData();
Rachel.Synopsis();
getch();
system("cls");
fout.close();
return 0;
}
It really is a lot
edit
there are many logical problems but those aren't what is stopping the program for working, i.e I don't have all the protected member varialbes initialized in the constructor when I planned on having them all be initialized. I also didn't include a synopsis for all of the variables, so far just skin color
edit