Hello,
I want to convert the following VB function to c/c++ function. I don't know how to deal with VB's Variant variable in C/C++. For some reason, I need function to return a char*. I tried to use template but I don't know how to convert a template variable to char*. any idea?

Private Function PerformOperation _
(ByVal S1 As String, ByVal Operator As String, ByVal S2 As String) As String

Dim result As Variant
Dim V1 As Variant, V2 As Variant
If Asc(S2) >= 48 And Asc(S2) <= 57 And Asc(S1) >= 48 And Asc(S1) <= 57 Then
V1 = CDbl(S1)
V2 = CDbl(S2)
Else
V1 = S1
V2 = S2
End If

Select Case Operator
Case Is = "&&"
result = V1 And V2
Case Is = "||"
result = V1 Or V2
Case Is = ">"
result = V1 > V2
.......
Case Is = "=="
result = V1 = V2
Case Is = "!="
result = Not (V1 = V2)
Case Is = "-"
result = V1 - V2
Case Is = "/"
result = V1 / V2
End Select
PerformOperation = CStr(CDbl(result))
End Function

Here is what I did
template <class T>
char* PerformOperation (T V1 , char *Operator , T V2 )
{
T result;
if (strcmp(Operator,"&&")==0 )
result = V1 && V2;
else if (strcmp(Operator, "||")==0 )
result = V1 || V2 ;
else if (strcmp(Operator, ">" )==0 )
result = V1 > V2 ;
else if (strcmp(Operator, "<" )==0 )
result = V1 < V2 ;
..................
else if (strcmp(Operator, "==" )==0 )
result = (V1 == V2) ;
else if (strcmp(Operator, "!=" )==0 )
result = (V1 != V2) ;
else if (strcmp(Operator, "-" )==0 )
result = V1 - V2 ;
else if (strcmp(Operator, "/" )==0 )
result = V1 / V2 ;

return result; //error here
}

I got error "Cannot convert 'bool' to 'char *' on return result;
What should I do?
Thanks!