<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>Hola que tal.</DIV>
<DIV> </DIV>
<DIV>Estoy intentando hacer el juego de piedra – papel y tijera. Para ello
utilizo rand() y uso un vector para rellenar el vector con unas cadenas de texto
específicas dependiento del valor que arroje rand(). Os pego un trozo de código
que es el que me está dando problemas:</DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New"> srand(time(NULL));</FONT></DIV>
<DIV><FONT face="Courier New"> int s = rand()%3;</FONT></DIV>
<DIV><FONT face="Courier New"> </FONT></DIV>
<DIV><FONT face="Courier New"> if(s == 0)</FONT></DIV>
<DIV><FONT face="Courier New"> {</FONT></DIV>
<DIV><FONT face="Courier New"> char
ordenador[] = "piedra";</FONT></DIV>
<DIV><FONT face="Courier New"> }</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"> if(s == 1)</FONT></DIV>
<DIV><FONT face="Courier New"> {</FONT></DIV>
<DIV><FONT face="Courier New"> char
ordenador[] = "papel";</FONT></DIV>
<DIV><FONT face="Courier New"> }</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"> if(s == 2)</FONT></DIV>
<DIV><FONT face="Courier New"> {</FONT></DIV>
<DIV><FONT face="Courier New"> char
ordenador[] = "tijera";</FONT></DIV>
<DIV><FONT face="Courier New"> }</FONT></DIV>
<DIV><FONT face="Courier New"> </FONT></DIV>
<DIV><FONT face="Courier New"> cout << "El valor de s
es: " << s << endl;</FONT></DIV>
<DIV><FONT face="Courier New"> cout << "El valor de
ordenador es: " << ordenador;</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV>El error que salta es que “ordenador” dice el compilador que no está
definido, no se, no funciona como espero, un poco de ayuda por favor.</DIV>
<DIV> </DIV>
<DIV>un saludo y gracias</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<META name=GENERATOR content="LibreOffice 3.4 (Win32)">
<META name=CREATED content=20111024;9105492>
<META name=CHANGED content=20111024;9124326>
<STYLE type=text/css>
<!--
@page { margin: 2cm }
p { margin-bottom: 0.21cm }
-->
</STYLE>
<P style="MARGIN-BOTTOM: 0cm"><BR><FONT color=#548dd4><FONT
face="Arial, sans-serif"><FONT size=2><I><B>Oscar Aparicio
Holgado</B></I></FONT></FONT></FONT><BR><FONT color=#e36c09><FONT
face="Tahoma, sans-serif"><FONT size=2>Administrador de
sistemas.</FONT></FONT></FONT></P></DIV></DIV></DIV></BODY></HTML>