Confused about incrementing

If have two values, a female value and a male value that both equals 10, so 10 females and males, and two of them mate and create a kid, and I put something like
1
2
3
4
5
6
7
		if (females_breeding <= males_breeding 
			|| females_breeding >= males_breeding 
			|| females_breeding == males_breeding)
		{
			kid_count++;
	}

and then another if statement saying if kid_count++ and then if that is true kids_age++, and treat each kid as if they were an individual with each having their own age from the time they were born. Is there a way i could achieve that with incrementing?
Last edited on
females_breeding <= males_breeding || females_breeding >= males_breeding || females_breeding == males_breeding
What are you trying to do here? (x <= y || x >= y || x == y) is an expression that cannot possibly be false, if x and y are numbers.

Anyway, it seems like you need a Person class.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Person{
    bool sex;
    int age = 0;
    //more?
public:
    Person(bool sex): sex(sex){}
    Person(const Person &) = default;
    Person &operator=(const Person &) = default;
    void advance_age(){
        this->age++;
    }
    bool can_breed() const;
    static Person breed(const Person &a, const Person &b);
};
Thank you, with my program I was taking a more of a procedural approach because I didn't fully understand classes yet, but that's fine. The x and y thing just worked and made sense to me , just saying if there were more or less females than males that they would still breed, probably not the best solution though.
Topic archived. No new replies allowed.