JJ> They are the knights that say neep! not nee.
#include
#include
#include
class Knights_who_say_NEEK
{
public:
Knights_who_say_NEEK(char*);
~Knights_who_say_NEEK(void);
int pass_by(char*);
private:
char *Neek;
};
void Knights_who_say_NEEK::Knights_who_say_NEEK(char *P = "shrubbery")
{
if(*P)
{
Neek = new char[strlen(P) + 1];
strcpy(Neek, P);
}
}
void Knights_who_say_NEEK::~Knights_who_say_NEEK(void)
{
delete []Neek;
}
int Knights_who_say_NEEK::pass_by(char *S)
{
int pass = 0;
if(!strcmp(S, Neek))
{
cout << "You may pass" << endl;
pass = 1;
}
else
{
char *p = Neek;
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_NEEK &K, char *P)
{
K.pass_by("");
cout << "( giving them a " << P << ". )" << endl;
K.pass_by(P);
}
int main(void)
{
char c;
Knights_who_say_NEEK *knights =
new Knights_who_say_NEEK;
Knights_who_say_NEEK *knights2 =
new Knights_who_say_NEEK ("cookie");
cout << "\n\n\n\n You have encountered the dreaded"
" Knights Who Say Neek!\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;
}
> ] You're trying to make me paranoid, but I'm on to your tricks
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)
|