<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>Hola, tengo un problema con el tema de las funciones. Quiero que cade vez que se llame a una función, esta devuelva el número de veces que ejecutó un bucle (esto tiene que ver con lo que me corregiste de la agenda, Steven). Y lo que hago es lo siguiente:</DIV>
<DIV> </DIV>
<DIV><FONT face="tahoma, new york, times, serif" color=#0000ff>#include<iostream><BR>using namespace std;</FONT></DIV>
<DIV><FONT face="tahoma, new york, times, serif" color=#0000ff>int Devolver(int);</FONT></DIV>
<DIV><FONT face="tahoma, new york, times, serif" color=#0000ff>int main()<BR>{<BR>    int k, cont = 0;<BR>    char a, d;<BR>    <BR>    do<BR>    {<BR>         cout << "Introduce una letra:\n";<BR>         cin >> a;<BR>         switch(a)<BR>         {<BR>                  case 'a': Devolver(cont);<BR>         }<BR>         cont = Devolver(cont);<BR>         cout << "Ahora cont vale: " << cont << "\nSeguir? (s/n)\n";<BR>         cin >>
 d;<BR>         cout << endl << endl << endl;<BR>    }while(d != 'n');<BR>    <BR>    cin.get();<BR>    return 0;<BR>}</FONT></DIV>
<DIV><FONT face="tahoma, new york, times, serif" color=#0000ff>int Devolver(int N)<BR>{<BR>    int x;<BR>    char r[10], y;<BR>    <BR>    for(x = N - 1; x < 10 && y != 'n'; x++)<BR>    {<BR>          cout << "Introduce una letra: \n";<BR>          cin >> r[x];<BR>          cout << "Seguir? (s/n)\n";<BR>          cin >> y;<BR>    }<BR>    <BR>    return x + 1;<BR>}<BR></FONT></DIV>
<DIV><FONT face="tahoma, new york, times, serif" color=#0000ff><FONT face="times new roman, new york, times, serif" color=#000000>Pero la variable 'cont' siempre vale 0.</FONT></FONT></DIV>
<DIV>¿Cuál es mi fallo?</DIV>
<DIV> </DIV>
<DIV>Un saludo y gracias, Alejandro.</DIV></DIV></DIV></div><br>
                <hr size=1><br><font face="Verdana" size="-2">LLama Gratis a cualquier PC del Mundo.<br>Llamadas a fijos y móviles desde 1 céntimo por minuto.<br><a href="http://us.rd.yahoo.com/mail/es/tagline/messenger/*http://es.voice.yahoo.com/">http://es.voice.yahoo.com</a></font></body></html>