cout<< (pi/pow(n,10))<<endl;invalid operands to binary expression ('TeamWorkBigInt' and 'TeamWorkBigInt')
时间: 2024-05-28 20:10:02 浏览: 72
这个错误通常是因为您在两个不兼容的类型之间执行了二进制操作符(如 +、-、*、/ 等)。在这种情况下,您需要检查您的代码,确保两个操作数都是相同类型的。
在这个特定的错误中,您可能正在尝试将一个“TeamWorkBigInt”类型的对象与一个“n”的10次幂的“double”类型值相除。您需要确保两个操作数的类型相同。如果您想要执行这个操作,您需要将“n”的10次幂转换为“TeamWorkBigInt”类型,然后再进行除法运算。
相关问题
incalid oprands to binary expression
"Invalid operands to binary expression" is an error message that occurs when the operands (values or variables) used in a binary expression (an operation with two operands such as addition, subtraction, multiplication, or division) are not compatible with each other.
For example, trying to add a string and an integer or dividing by zero would result in this error message.
Here are some examples of invalid operands to binary expression:
1. Adding a string and an integer:
```
string str = "hello";
int num = 5;
cout << str + num; // error: invalid operands to binary expression ('std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >' and 'int')
```
2. Dividing by zero:
```
int num1 = 10;
int num2 = 0;
cout << num1 / num2; // error: invalid operands to binary expression ('int' and 'int')
```
3. Using bitwise operators on non-integer types:
```
float num1 = 3.14;
float num2 = 2.71;
cout << (num1 & num2); // error: invalid operands to binary expression ('float' and 'float')
```
阅读全文