no match for 'operator==' in 'subexpresionesparentesis[2] == '*'

#include <iostream>
#include <string.h>

using namespace std;

int main()
{

string expresion;
unsigned int i, k=1;


string subexpresionesparentesis[20];
string subexpresionessignos[20];

for(i=0; i<=19; i++){
subexpresionesparentesis[i]="";
subexpresionessignos[i]="";
}


cout<<"\n Ingrese la expresion a derivar: ";
cin>>expresion;

for(i=0; i<=expresion.length(); i++){

subexpresionesparentesis[k]=subexpresionesparentesis[k]+expresion[i];

if(expresion[i+1]=='('){
k++;
subexpresionesparentesis[k]='*';
k++;
}

if(expresion[i+1]=='/'){
k++;
subexpresionesparentesis[k]='/';
k++;
i++;

}



}


/*
cout<<"\n La funcion posee "<<k<<" subfunciones para derivar. \n";

for(i=1; i<=k; i++){

cout<<"\n"<<i<<".) "<<subexpresionesparentesis[i];


}*/


cout<<"\n";

if(subexpresionesparentesis[2] == '*'){

cout<<"\n Regla del producto: ";

cout<<"\n dx"<<subexpresionesparentesis[1]<<subexpresionesparentesis[3]<<"+"<<subexpresionesparentesis[1]<<"dx"<<subexpresionesparentesis[3];

}

if(subexpresionesparentesis[2] == '/'){

cout<<"\n Regla del cociente: ";

cout<<"\n (dx"<<subexpresionesparentesis[1]<<subexpresionesparentesis[3]<<"-"<<subexpresionesparentesis[1]<<"dx"<<subexpresionesparentesis[3]<<")/"<<"("<<subexpresionesparentesis[3]<<")^2";

}


return 0;
}




I am getting
C:\Users\Daniel\Documents\Universidad\ProyectosCpp\derivadas\main.cpp|60|error: no match for 'operator==' in 'subexpresionesparentesis[2] == '*''|



why??!?!?!??!

thanks!
String literals are in double-primes (" "), char literals in single-primes (' '). subexpresionesparantesis[2] is a string. subexpresionesparantesis[2][i] would be a char.

On line 60 (or what I believe to be line 60 anyway; if you don't use code tags, we can't see line numbers...) you're comparing a string to a char. Replace '*' with "*" and it should work.
ty gaminic, i love you.
Topic archived. No new replies allowed.