Im making a RPG game at the moment... Do any of you have
any ideas how to code the following?

player speaks to character in game

player has no key so character says you have no key

player has key so character says well done for finding it

would this sort of thing work:

Code:
if ( key <= 0 )
{
gotoxy(12,32);char senta[]= "You need a key";
}

if ( key >= 1 )
{
gotoxy(12,32);char sentb[]= "You have the key";
}

else
{
cerr << "ERROR in code";
}
That is only one idea,,, am I on the right lines? Or is there a better
way to acheive the same result?