Afficher un message
Vieux 30/06/2008, 12h11   #16
Lionel B
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: strcmp, please me understand this

On Sun, 29 Jun 2008 22:04:31 -0700, Marcus wrote:

> On Jun 29, 8:58Âpm, CD1 <cristiandei...@gmail.com> wrote:
>> > #include <string>
>> > #include <iostream>

>>
>> > int main()
>> > {
>> > Â Â std::string foo("ABC");
>> > Â Â std::string f002("ABC");

>>
>> > Â Â if(foo == foo2)
>> > Â Â Â Â std::cout << "match\n";
>> > Â Â else
>> > Â Â Â Â std::cout << "no match\n";

>>
>> > Â Â return 0;

>>
>> > }

>>
>> This code won't compile. There is no variable called "foo2".
>>
>> - Hide quoted text -
>>
>> - Show quoted text -

>
> haha.... i wasn't going to say anything, but that made me laugh... yea
> mike, i simply can't understand what you're trying to say here at all!
>


He was making the reasonable and potentially ful suggestion that you
might consider using the the std::string class rather than char*, as it
makes comparison much simpler and less error-prone.

> thanks for the guys, seriously. i'm just trying to point out, that
> communication is a lot easier when the listener tries to understand the
> meaning behind things, rather than dismissing the entirety if an i
> wasn't dotted or a t wasn't crossed. i think yall get what i'm saying...
> or did i miss an apostophe somewhere?


Seeing as you're asking a bunch of total strangers to take the time and
trouble to you, don't you think it might be a good idea to make it
easier for them to do so? This is why people request complete, compilable
code: it makes it easier to .

--
Lionel B
  Réponse avec citation
 
Page generated in 0,06507 seconds with 9 queries