Just to make sure its perfectly clear since I can see you possibly not understanding what they're saying.
This is what you have after the first response:
Code:
if (TS = +)
{
Resultat = Första + Andra;
}
if (TS = -)
{
Resultat = Första - Andra;
}
if (TS = / )
{
Resultat = Första / Andra;
}
if (TS = *)
{
Resultat = Första * Andra;
}
This is what it should be:
Code:
if (TS == "+")
{
Resultat = Första + Andra;
}
if (TS == "-")
{
Resultat = Första - Andra;
}
if (TS == "/" )
{
Resultat = Första / Andra;
}
if (TS == "*")
{
Resultat = Första * Andra;
}
First off as the first reply mentioned, to compare values in the manner you have above you use ==. This is because just using the = sign is the operator for assignment within the compiler.
Secondly, what you intend to do is compare string values (or perhaps chars, but I doubt it =) ). For Strings, you have to use double quotes around them. This is how the compiler knows that its using a string.
Also as a bonus tip. If you have just one line after an if or for statement, you do not need to have brackets around the code. For example, you can also write this as.
Code:
if (TS == "+")
Resultat = Första + Andra;
if (TS == "-")
Resultat = Första - Andra;
if (TS == "/" )
Resultat = Första / Andra;
if (TS == "*")
Resultat = Första * Andra;
Good Luck.