#include
#include
#include
class Knights_who_say_NEEP
{
public:
Knights_who_say_NEEP(char*);
~Knights_who_say_NEEP(void);
int pass_bychar*);
private:
char *Neep;
};
void Knights_who_say_NEEP::Knights_who_say_NEEP(char *P = "shrubbery")
{
if(*P)
{
Neep = new char[strlen(P) + 1];
strcpy(Neep, P);
}
}
void Knights_who_say_NEEP::~Knights_who_say_NEEP(void)
{
delete []Neep;
}
int Knights_who_say_NEEP::pass_by(char *S)
{
int pass = 0;
if(!strcmp(S, Neep))
{
cout << "You may pass" << endl;
pass = 1;
}
else
{
char *p = Neep;
cout << "You may not pass until you bring us...\n"
"... A ";
for(; *p; p++)
cout << char(toupper(*p));
cout << "!!" << endl;
}
return pass;
}
void nicky_nicky_nicky_nicky_nU(Knights_who_say_NEEP &K, char *P)
{
K.pass_by("");
cout << "( giving them a " << P << ". )" << endl;
K.pass_by(P);
}
int main(void)
{
char c;
Knights_who_say_NEEP *knights =
new Knights_who_say_NEEP;
Knights_who_say_NEEP *knights2 =
new Knights_who_say_NEEP ("cookie");
cout << "\n\n\n\n You have encountered the dreaded"
" Knights Who Say Neep!\n You must comply with"
" their demands to continue!\n\n" << flush;
nicky_nicky_nicky_nicky_nU(*knights, "shrubbery");
delete knights;
nicky_nicky_nicky_nicky_nU(*knights2, "cookie");
delete knights2;
cout << "Enter any character and ENTER to exit." << endl;
cin >> c;
return 0;
}
--- SuperBBS 1.17-3 (Reg)
---------------
* Origin: The Richwood BBS, SuperBBS Support/Reg, (409)265-5958 (1:3812/10)
|