![]() If I remove the constants and add them in before each std::cout, then it runs fine. error: invalid operands of types int and const char 2 to binary operator<<. There are many solutions to this each of which depend on what you want to do. Ignoring that this is quite inelegant, when I run this through the compiler, G++, I get the error message. These two values are the main cause for the error. I have written this code as an assignment wherein some computations are. Also, the function pow from the math library returns a value of type double. ![]() ![]() It appears from the error message that the variable number1 is of type double. The remainder operator (otherwise known as the modulo operator) % is a binary operator (i.e., takes exactly 2 operands) and operates only on integer types (e.g., short, int, long, long long, etc).
0 Comments
Leave a Reply. |