Can strcmp() work with strings in c++?

后端 未结 3 1616
孤独总比滥情好
孤独总比滥情好 2021-01-22 18:46

I have this line of code

if(strcmp(ob[i].getBrand(), ob[j].getBrand()) > 0)

and I get this error

error C2664: \'strcm

3条回答
  •  生来不讨喜
    2021-01-22 19:20

    Simply use .c_str() to convert a string to char array, then you are able to use strcmp().

    But in your case, use > is better :)

提交回复
热议问题