-
Help!!
Is there anything that stands out in the following code that could cause me to get the error message "comparison between distinct pointer types lacks a cast" upon trying to compile it? I'm brand new to programming, so I apologize in advance if this code is hideous. . .
Code:
#include <iostream>
#include <cmath>
#include "is_an_op.h"
using namespace std;
double do_op(char op, double num_one, double num_two)
{
if (op == '/') && (num_two == 0)
return 0.0;
else if (is_an_op == "true") && (op == '+')
return num_one + num_two;
else if (is_an_op == "true") && (op == '-')
return num_one - num_two;
else if (is_an_op == "true") && (op == '*')
return num_one * num_two;
else if (is_an_op == "true") && (op == '/')
return num_one / num_two;
else
return 0.0;
}
Thanks!
-
You probably want to call is_an_op, not use it as a pointer to a function.
-
are you using a character array when calling the function?