Efficiency?

So, I created a "conversation" program in which the user inputs something like, "hi" and the program responds. The way I analyzed the in put was:

1
2
3
4
5
6
string input;

if(input.find("Hi")!=string::npos)
{
	cout<<"Hey there! What's up?";
}


The person teaching me C++ (I'm not taking classes) said that this was a very inefficient way to do this. He said that !=string::npos was not a good way to do it.

Does anyone know a quicker, better way to do this?
No, this is the correct way to do this.
Although you should ask him why he thinks it is bad and what he suggests instead.
Ok, thanks!
Topic archived. No new replies allowed.