error: no match for operator ==

后端 未结 1 1497
臣服心动
臣服心动 2021-01-29 07:37

I\'m receiving an error for multiple areas of my three files. (I\'m also having problems with my default constructor, which is why it is commented out. But I want to solve this

相关标签:
1条回答
  • 2021-01-29 07:43

    Since computerType is a string, its operator==() is declared to compare with another string (enclosed by double quote "), not another character (enclosed by single quote ').

    Thus,

    computerType == 'd' || computerType == 'D'
    

    should be rewritten as

    computerType == "d" || computerType == "D"
    
    0 讨论(0)
提交回复
热议问题