Código
string Miembro1 = "2x-5(65x-8(3-8+5x)-9)+3"
int h = 0;
string s;
bool sigue = false;
if (Miembro1.Contains("("))
{
for (int i = 1; i < Miembro1.Length; i++)
{
try
{
if (Miembro1.IndexOf("(", i, i) != -1)
{
s = Miembro1.Substring(Miembro1.IndexOf("(", i));
for (int k = 1; k < s.Length; k++)
{
if (s.Substring(1, k).EndsWith(")"))
{
if (sigue == false) { h++; break; }
else { sigue = true; }
}
if (s.Substring(1, k).EndsWith("("))
{
sigue = true;
}
a[h] = s.Substring(1, k);
}
}
}
catch { }
}
}
foreach (string r in a)
MessageBox.Show(r);
Quiero q en este caso por ejemplo salgan 2 mensajes, uno q diga "65x-8(3-8+5x)-9" y el otro q diga "3-8+5x"
Si me entienden lo q quiero hacer se daran cuenta q quiero q sirva para otros por ejemplo "2x4(-6+9)" y ahi largaria solo un mensaje..
Y si tiene uno como "6x-8+3(48x-8(6-2(1+7)+2)-8)" q haga lo mismo..
Pero creo q si arreglan mi codigo para q ande con la ecuacion q pido al principio, ya andara para esos otros, asique si pudieran arreglarlo les agradeceria mucho!
pd: Ven q use el Try, esq me daba un error, talvez lo pueden hacer q funcione sin ese error no se :S


 
  




 Autor
 Autor
		



 En línea
									En línea
								



 
						 
						 
						 
						