#include <iostream>
#include <math.h>
#include <string>
usingnamespace std;
//Math functions (censored)
int main()
{
char A='A', S='S', M='M', D='D', s='s', E='E';
string options;
float a, b, c, d, e, f, g, h, i, r;
do
{
printf ("What would you like to do?\n \n A - Addition\n S - Subtraction\n M - Multiplication\n D - Division\n s - Square Root\n E - Exit\n \n");
cin >> options;
if (options == "A")
{
//Addition
}
elseif (options == "S")
{
//Subtraction
}
elseif (options == "M")
{
//Multiplication
}
elseif (options == "D")
{
//Division
}
elseif (options == "s")
{
//Square Root
}
elseif (options == "E")
{
return 0;
}
else
{
printf ("\n");
printf ("Incorrect symbol\n");
}
printf ("\n");
} while (options == 'A'|'S'|'M'|'D'|'E'|'s');
}
The underlined code has an error (According to MinGW CMDline) that says this:
name.cpp:line: error: No match for 'operator==' in 'options == '(first letter in the line)''
I've tried just about everything I can think about with debugging... I'm also a beginner so I don't know how to debug that well... Anyone know what's up? :\
EDIT:: It does the same thing without the single quote-marks.
Well, first off, you are using the bitwise | operator, which will completely screw it up...you want the logical or (||). Secondly, you can't do it the way you are doing it, you must do it this way:
while (options == "A" || options == "S" || /*...*/);