No problem

And as for the line
if (x!=string::npos)...
string:: just says that you're using the string namespace - which you need to do because the value
npos is defined in that namespace.
The find() function returns an index of where the substring was found within your string, and it is this returned index value that gets assigned to x. When the find() method doesn't find the substring, it needs some way to tell you this - so it returns
string::npos, which is a negative value and wouldn't otherwise make any sense as an index into a string. It's basically just an arbitrary value that indicates the case when the string isn't found.
If you find the namespace thing confusing, just remember that you are already using the
std namespace in your program, which is where objects like cin, cout, and endl are defined. If you didn't have the line
using namespace std; before your main routine, you would have to make your output calls like this:
CODE
std::cout << x << std::endl;
where you explicitly state which namespace you are talking about when you refer to cout and endl.
Oh, and one final point - you should define an int return type for main, not void, and you would then need to have it return an int at the completion of the program:
CODE
int main() {
//...
//...
return 0; //last line in main()
}
Hope that helps

-jjh
This post has been edited by jjhaag: 30 Oct, 2007 - 05:08 PM