#include <iostream>
class Indeez
{
public:
Indeez(int initialLevelOfDisRespect);
~Indeez();
int GetLevelOfDisRespect() const;
void ExcuseYourself(int numberOfTimes);
void SorryAgain();
private:
int levelOfDisRespect;
};
Indeez::Indeez(int initialLevelOfDisRespect)
{
levelOfDisRespect = initialLevelOfDisRespect;
}
Indeez::~Indeez()
{
}
int Indeez::GetLevelOfDisRespect() const
{
return levelOfDisRespect;
}
void Indeez::ExcuseYourself(int numberOfTimes)
{
levelOfDisRespect = levelOfDisRespect - numberOfTimes;
}
void Indeez::SorryAgain()
{
std::cout << "\nSorry again Indeez! It was my mistake! =\\ \n\n";
}
int main()
{
int disre, apol, cur_disre;
std::cout << "What's my level of disrespect?\n";
std::cout << "*HINT* (negative integer = no disrespect, positive integer = presence of disrespect)" << std::endl;
std::cin >> disre;
Indeez GaburichIndeez(disre);
GaburichIndeez.SorryAgain();
std::cout << "My unrespectful behaviour led to " << GaburichIndeez.GetLevelOfDisRespect() << " points of disrespect! \n";
GaburichIndeez.SorryAgain();
std::cout << "How many times should i apologize ? \n";
std::cin >> apol;
GaburichIndeez.ExcuseYourself(apol);
std::cout << "I apologized for " << apol << " times. I think now my level of disrespect should be " <<GaburichIndeez.GetLevelOfDisRespect() << std::endl;
cur_disre = GaburichIndeez.GetLevelOfDisRespect();
if ((cur_disre < 0) || (cur_disre == 0))
{
std::cout << "I think you excused me! Thanks a lot! =) \n";
}
else
{
std::cout << "Compile me one more time and ask for more excuses! =(( \n";
}
GaburichIndeez.SorryAgain();
return 0;
}ЗЫ: Сорри за неиспользование более аццких операторов ветвления - ибо как неумен!












