//Critter Caretaker
//Simulates caring for a virtual pet
#include <iostream>
usingnamespace std;
class Critter
{
public:
Critter(int hunger = 0, int boredom = 0);
void Talk();
void Eat(int food = 4);
void Play(int fun = 4);
private:
int m_Hunger;
int m_Boredom;
int GetMood() const;
void PassTime(int time = 1);
};
Critter::Critter(int hunger, int boredom):
m_Hunger(hunger),
m_Boredom(boredom)
{}
inlineint Critter::GetMood() const
{
return (m_Hunger + m_Boredom);
}
void Critter::PassTime(int time)
{
m_Hunger += time;
m_Boredom += time;
}
void Critter::Talk()
{
cout << "I'm a critter and I feel ";
int mood = GetMood();
if (mood > 15)
{
cout << "mad.\n";
}
elseif (mood > 10)
{
cout << "frustrated.\n";
}
elseif (mood > 5)
{
cout << "okay.\n";
}
else
{
cout << "happy.\n";
}
PassTime();
}
void Critter::Eat(int food)
{
cout << "Brrupp.\n";
m_Hunger -= food;
}
int main()
{
}
For okay and Brrupp it say's //OBJECTS over it. It doesn't effect the program building but it shouldn't have a redline i.e error under it. Anyone know why? This isn't the full program it's not done yet but this is confusing me