you could use an array of structures
struct phrases
{
char* correct;
char* response;
};
phrases ph[] = {
{"CU","See You\n"},
{":-)", "I'm happy\n"},
// etc
};
cout << "Enter phrase>";
cin >> input;
for(int i = 0; i < sizeof(ph)/sizeof(ph[0]); ++i)
{
if(stramp(input, ph[i].correct) == 0)
{
cout << ph[i].response;
break;
}
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
you could also use c++ std::map class, but may or may not be too advanced for you at this time.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343