1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
string sytnaxengine(string syntax)
{
if (syntax == "north","n") {syntax = "gon";}
else if (syntax == "south","s") {syntax = "gos";}
else if (syntax == "west","w") {syntax = "gow";}
else if (syntax == "east","e") {syntax = "goe";}
else if (syntax == "up","u") {syntax = "gou";}
else if (syntax == "down","d") {syntax = "god";}
else if (syntax == "examine","look around","look","check room","examine surroundings") {syntax= "examine";}
else if (syntax == "invenvtory","check inventory","items") {inventory(syntax);}
else if (syntax == "where am I?","what room am I in?","where am i?","what room am i in?","where am i","what room am i in","check room","room") {roomcheck(syntax);}
return syntax;
};
//begin program
int actmain()
{
string x = "";
cin >> x;
x = sytnaxengine(x);
if (x == "gon") {cout << "you go north";}
else if (x == "gos") {cout << "you go south";}
else if (x == "gow") {cout << "you go west";}
else if (x == "goe") {cout << "you go east";}
return 0;
};
| |