I am trying to write this loop in a simple convert process, but I get all sorts of crazy errors when I try using the "not equals" operators.

here is my code:

int main()
{
int i = 5;
std::string s;
do
{
cout<<" Enter a string: ";
cin>>s;
cout<<endl;
double x = converToDouble(s);
cout<<" The answer is " << x<<endl;
i--;
}while (s<>'q');
return 0;
}

The line before the "return 0", I try using "<>" and "!=", but both give me errors like "error C2059: syntax error '>' " and if I used "!=" then I get "...could not deduce template argument for 'const _Elem *' from 'char'"

Is there a certain library I need to include to use these compare operators?

I'm Using Visual C++ 2005 Express.

Thanks!

>"error C2059: syntax error '>' "
<> doesn't mean "not equal to". You want the != operator.

>"...could not deduce template argument for 'const _Elem *' from 'char'"
String literals use double quotes and character literals use single quotes. Try s != "q" . Of course, I would be a little suspicious of your logic because even if the string is "q", you still convert and print it.

Thanks! :) That definitely got it! I can't recall that I needed to use the double quotes for strings but I guess I'm so used to the single quotes that I forgot about that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.