#include <BirthdayCake.h>
int main(Congratulations)
{
int i;
for(LinuxWolf; i <= 34; i++)
{
printf("%d ", "Happy Birthday!!!");
}
for(i=1; i <= 34; i++)
{
printf("%d ", Best wishes, health, happiness, love and career success!);
}
return 0;
}
#include <algorithm>
#include <iostream>
#include <vector>
namespace Sfx
{
enum e
{
extinguished,
blow,
};
void play(enum e x)
{
std::cout << "sound effect: " << x << std::endl;
}
};
class Candle
{
public:
typedef std::vector<Candle> Vec;
bool burning;
Candle() : burning(true)
{
}
void extinguish(void)
{
if (burning)
{
Sfx::play(Sfx::extinguished);
burning = false;
}
}
};
typedef Candle::Vec Cake;
void extinguishCandle(Candle &candle)
{
candle.extinguish();
}
class LinuxWolf
{
public:
int age;
LinuxWolf() : age(34)
{
}
void blow(Cake &cake)
{
Sfx::play(Sfx::blow);
std::for_each(cake.begin(), cake.end(), extinguishCandle);
}
};
int main(int argc, char **argv)
{
LinuxWolf linuxWolf;
Cake cake(linuxWolf.age);
linuxWolf.blow(cake);
const std::string s("I'm glad you handled the candles");
return std::accumulate(s.begin(), s.end(), 0);
}
Users browsing this forum: No registered users and 1 guest