Another error code...

Hello again!
I am creating a simple calculator, just for fun.
I keep getting this error: " ISO C++ forbids comparison between pointer and integer"... What does it mean and what did i do wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Calculator

#include <iostream>
using namespace std;


int main ()
{
    //variables
    int fir;
    int sec;
    char op;
    
    //enter stuff in
    cout << "Welcome to my Calculator!\nPlease enter your first number!\n:  ";
    cin >> fir;
    
    do {
    cout << "Please write your Operator! (+,-,*,/)\n:  ";
    cin >> op;
    }while (op == "+" || "-" || "*" || "/" ); //Error here

    cout << "Please write your second number!\n:  ";
    cin >> sec;
    
    //more stuff is going here later, please don't complain over my lack of code in this spot...

    //end stuff
    return 0;
}

Thank you in advance!
MisterArrow
Last edited on
There is an error in your do-while loop, this is the correct code:

1
2
3
4
do {
	cout << "Please write your Operator! (+,-,*,/)\n:  ";
	cin >> op;
	}while (!(op == '+' || op == '-' || op == '*' || op == '/' ));
Oh, thank you! Now it works as a charm! Thank you @modoran!
Topic archived. No new replies allowed.