Skip to content

Instantly share code, notes, and snippets.

@oppahero
Created April 1, 2018 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oppahero/d04330006c3365f711a48cc1fce485fe to your computer and use it in GitHub Desktop.
Save oppahero/d04330006c3365f711a48cc1fce485fe to your computer and use it in GitHub Desktop.
//Separando elementos de la expresión
for (int n = 0; n < operacion.length(); n++) {
c = operacion.charAt(n);
if ( c != '(' && c != '*' && c != ' ' && c != ')' ){ //Mientras no sea un caracter especial
aux+=c; //Acumulamos
}else{
if (bandera)
PrimeraOperacion.push(aux);
else{
if (c == '(')
bandera= true;
else{
if (a!=1)
SegundaOperacion.push(aux);
}
}
if (c == ')'){
a=1;
bandera=false;
}
aux="";
}
}
if ( c!= ')' && bandera==false){
SegundaOperacion.push(aux);
operador = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment