请教两个c++ 错误报告

来源:百度知道 编辑:UC知道 时间:2024/06/06 00:27:58
第一个no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion
第二个does not define this operator or a conversion to a type acceptable to the predefined opera

1,没有一种操作符定义了对右操作数类型的处理(或者合适的转换)
2.没有定义这种操作数或者转换成可以接受的类型预定义操作数.

意思就是说,
类型与操作不匹配,
你需要检查一下你对你定义的类型进行了怎样的操作,那种操作你事先定义了吗?

给你一个错误的例子,
比如说,你不能对两个
string s1,s2;
s1-s2;

这样的话,编译器也会报你这样的错误,原因就是没有对string的 s1和s2 有'-'的操作.

唉,字符串少打了引号。