Falling Down

// Falling_Down.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include
#include
#include

using namespace std;

enum friendship
{
    ENEMY,
    NEUTRAL,
    WIFE,
    DETECTIVE,
    FRIEND,
    DAUGHTER,
};
void WalkToDaughter(void);
int GetTarget(void);
void Kill(int Target);
void CheckFriendship(int Target);

void WalkToDaughter(void)
{
cout<<"Walking... n";
int tar = GetTarget();
CheckFriendship(tar);
}

int GetTarget(void)
{
    return rand() % 5;
}
void Kill(int Target)
{
    cout<<"Killed human. n";
}
void BeHappy(void);
void BeHappy(void)
{
    cout<<"I am happy n";
}
void CheckFriendship(int Target)
{
    switch (Target)
    {
    case 0:
    Kill(Target);
    WalkToDaughter();
    break;
    case 1:
    WalkToDaughter();
    break;
    case 2:
    WalkToDaughter();
    break;
    case 3:
    cout << "Died! n";
    break;
    case 4:
    WalkToDaughter();
    break;
    case 5:
    BeHappy();
    break;
    }
}

int _tmain(int argc, _TCHAR* argv[])
{
    WalkToDaughter();
    _getch();
    return 0;
}
Vote up this code0
  • David

    Why define an enum and then use numeric constants in the switch statement?

    • MaSTeR

      To do a dramatic atmosphere

    • MaSTeR

      I just forget that I defined enum, I just writed this code when coded mod for half-life and codes mixed in my head )