-2
I’m getting the error message: "main.cpp: In Function 'int main()': main.cpp:8:16: error: lvalue required as left operand of assignment (-10))/76=n-1;"
In the code snippet below,?
#include
using namespace std;
int main(){
int ano;
cin>>ano;
int passagem;
int n;
(ano-10)/76=n-1;
passagem=(10+76)*(n-1);
}'
Are you trying to use the equal sign that is used to define variable values to set the value to another value? This doesn’t make much sense
(ano-10)/76=n-1;, the sign of=is used to set values in variables, for exampleint a = n-1;, does things like1+1=5+2;it wouldn’t make sense. What exactly are you trying to do?– Guilherme Nascimento
It seems to me an undue mixture of math and programming. The equality of mathematics has to be converted to attribution, so that the variable is on the left of the
=(in mathematics the=is equality. in most languages the=is attribution, as answered by @Guilherme). Example:x-7=12has to be "converted" tox = 12 + 7. another example:7 - y = n * 12have to turnn = ( 7 - y ) / 12, if you already have theyand wants to get then.– Bacco