elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


  Mostrar Temas
Páginas: [1]
1  Programación / .NET (C#, VB.NET, ASP) / Modificar registros sQL desde visual studio 2008 en: 12 Mayo 2012, 01:16 am
Lo que pasa es que necesito modificar un registro pero no se que funcion puedo usar encontre en internet esa forma de insertar registros y me funciono pero...lo intente para modificar los registros pero...no salio  :huh:
Código:
Imports System.Data
Imports System.Data.SqlClient
Public Class Form4
    Dim user As Integer

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim Conexion As New SqlConnection(conectar("EVE\SQLEXPRESS", "pollo"))

        Dim sql1 As String = "Select * from numusuarios"
        Dim DE As New SqlDataAdapter(sql1, Conexion)
        Dim Dg As New DataSet
        DE.Fill(Dg, "numusuarios")
        Dim fila As DataRow
        fila = Dg.Tables("numusuarios").Rows(0)
        user = fila("numero")
        Dim user1
        user1 = user

        user = user + 1



     
        Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("proceso1", Conexion)
        Dim asd1 As DataTable = New DataTable()

        Dim sql As String = "UPDATE numusuarios SET numero=@NOMBRE where numero=@numeroas"

        Dim cmd As New SqlCommand(sql, Conexion)

        adapter1.SelectCommand.CommandType = CommandType.StoredProcedure
        cmd.Parameters.Add("@NOMBRE", SqlDbType.Int).Value = user '
        adapter1.SelectCommand.Parameters.Add(New SqlClient.SqlParameter("@NOMBRE", user))

        adapter1.SelectCommand.Parameters.Add(New SqlClient.SqlParameter("@numeroas", user1))

     
     
       

        Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("proceso2", Conexion)
        Dim asd As DataTable = New DataTable()
        adapter.SelectCommand.CommandType = CommandType.StoredProcedure
        adapter.SelectCommand.Parameters.Add(New SqlClient.SqlParameter("@clave", user))
        adapter.SelectCommand.Parameters.Add(New SqlClient.SqlParameter("@usuario", Me.TextBox1.Text))
        adapter.SelectCommand.Parameters.Add(New SqlClient.SqlParameter("@contra", Me.TextBox2.Text))
        adapter.Fill(asd)
        adapter.Dispose()
        MessageBox.Show("registro guardado")


    End Sub




    Private Function conectar(ByVal servidorsql As String, ByVal basedatos As String) As String
        Dim cnn As String
        cnn = "data source = '" & servidorsql & "'; initial catalog = '" & basedatos & "'; INTEGRATED SECURITY = TRUE "
        Return cnn
    End Function


End Class

en el caso de ese codigo el registro que quiero modificar es para llevar la cuenta de los usuarios que estan registrados espero y me puedan ayudar...gracias.
2  Programación / .NET (C#, VB.NET, ASP) / Duda visual studio 2008 y SQL en: 10 Mayo 2012, 22:53 pm
Hola buenas tardes...lo que pasa es que estoy estudiando una carrera tecnica en informatica y me gustaria aprender a programar. en estos momentos tengo que hacer un sistema con visual studio 2008 y SQL la profesora nos paso un codigo para "cargar la base de datos"y funciona pero no se que demonios hacen las lineas que copie y queria ver si podian hacerme el favor de explicarme que hacen las lineas para entenderlo ya que la profesora no sabe programar y los codigos que nos trae son hechos por su esposo...xD


Aqui esta mi codigo:
Código:

Imports System.Data
Imports System.Data.SqlClient

Public Class frmModificaciones
#Region "Buscar"
    Dim variable As String
    Dim nombre As String
    Dim numero As Integer
    Dim user As Integer

    Public Sub Consultar(ByVal Codigo As String)
        Try
            Dim Conexion As New SqlConnection(conectar("EVE\SQLEXPRESS", "pollo"))
            Dim sql As String = "Select * from contraseña"
            Dim sql1 As String = "Select * from numusuarios"
            Dim DA As New SqlDataAdapter(sql, Conexion)
            Dim DE As New SqlDataAdapter(sql1, Conexion)
            Dim DS As New DataSet
            Dim Dg As New DataSet

            DA.Fill(DS, "contraseña")
            DE.Fill(Dg, "numusuarios")

            Dim fila As DataRow

            fila = Dg.Tables("numusuarios").Rows(0)

            user = fila("numero")


            If DS.Tables("contraseña").Rows.Count > 0 Then


                For i = 0 To user

                    fila = DS.Tables("contraseña").Rows(i)



                    variable = fila("usuario")
                    If variable = ComboBox1.Text Then
                        variable = fila("contra")

                        nombre = fila("usuario")
                        numero = i

                        If Codigo = 2 Then
                            If variable = TextBox2.Text Then
                                Me.Hide()
                                Form2.Show()
                            Else
                                MessageBox.Show("CONTRASEÑA INCORRECTA")
                            End If
                        End If


                    End If
                Next

            End If
        Catch ex As Exception

        End Try
    End Sub
#End Region
    Private Function conectar(ByVal servidorsql As String, ByVal basedatos As String) As String
        Dim cnn As String
        cnn = "data source = '" & servidorsql & "'; initial catalog = '" & basedatos & "'; INTEGRATED SECURITY = TRUE "
        Return cnn
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Consultar(2)
    End Sub
    Private Sub frmModificaciones_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
    Private Sub ComboBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.LostFocus
        Consultar(1)
        TextBox3.Text = numero
    End Sub
End Class
3  Programación / Programación C/C++ / turbo c++ ayuda con el gato en: 15 Septiembre 2010, 17:47 pm
bueno pues no tengo mucho que empeze a usar el turbo c++ y quisiera saber si ay alguna funcion para hacer mas corto el juego del gato contra la computadora
tambien soy nuevo en el foro y esto es lo que yevo
Código
  1. #include<iostream.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int g;
  7. char r[100];
  8. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  9. cout<<"   |   |             |   |    "<<endl;
  10. cout<<" 1 | 2 | 3           |   |   "<<endl;
  11. cout<<"___|___|___       ___|___|___"<<endl;
  12. cout<<"   |   |             |   |   "<<endl;
  13. cout<<" 4 | 5 | 6           |   |   "<<endl;
  14. cout<<"___|___|___       ___|___|___ "<<endl;
  15. cout<<"   |   |             |   |  "<<endl;
  16. cout<<" 7 | 8 | 9           |   |  "<<endl;
  17. cout<<"   |   |             |   |  "<<endl;
  18. cin>>r[0];
  19. if(r[0]=='1' || r[0]=='2' || r[0]=='3' || r[0]=='4' || r[0]=='5' || r[0]=='6' || r[0]=='7' || r[0]=='8' || r[0]==9)
  20. {//ciclo del gato
  21. if(r[0]=='1')
  22. {//if del 1-1
  23. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  24. cout<<"   |   |             |   |    "<<endl;
  25. cout<<" 1 | 2 | 3         X |   |   "<<endl;
  26. cout<<"___|___|___       ___|___|___"<<endl;
  27. cout<<"   |   |             |   |   "<<endl;
  28. cout<<" 4 | 5 | 6           |   |   "<<endl;
  29. cout<<"___|___|___       ___|___|___ "<<endl;
  30. cout<<"   |   |             |   |  "<<endl;
  31. cout<<" 7 | 8 | 9           |   | O "<<endl;
  32. cout<<"   |   |             |   |  "<<endl;
  33. cin>>r[1];
  34. if(r[1]=='2')
  35. {
  36. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  37. cout<<"   |   |             |   |    "<<endl;
  38. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  39. cout<<"___|___|___       ___|___|___"<<endl;
  40. cout<<"   |   |             |   |   "<<endl;
  41. cout<<" 4 | 5 | 6           |   |   "<<endl;
  42. cout<<"___|___|___       ___|___|___ "<<endl;
  43. cout<<"   |   |             |   |  "<<endl;
  44. cout<<" 7 | 8 | 9           |   | O"<<endl;
  45. cout<<"   |   |             |   |  "<<endl;
  46. cin>>r[2];
  47. if(r[2]=='4')
  48. {
  49. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  50. cout<<"   |   |             |   |    "<<endl;
  51. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  52. cout<<"___|___|___       ___|___|___"<<endl;
  53. cout<<"   |   |             |   |   "<<endl;
  54. cout<<" 4 | 5 | 6         X |   | O "<<endl;
  55. cout<<"___|___|___       ___|___|___ "<<endl;
  56. cout<<"   |   |             |   |  "<<endl;
  57. cout<<" 7 | 8 | 9           |   | O "<<endl;
  58. cout<<"   |   |             |   |  "<<endl;
  59. cout<<"gane ^^ "<<endl;
  60. }
  61. if(r[2]=='5')
  62. {
  63. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  64. cout<<"   |   |             |   |    "<<endl;
  65. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  66. cout<<"___|___|___       ___|___|___"<<endl;
  67. cout<<"   |   |             |   |   "<<endl;
  68. cout<<" 4 | 5 | 6           | X | O "<<endl;
  69. cout<<"___|___|___       ___|___|___ "<<endl;
  70. cout<<"   |   |             |   |  "<<endl;
  71. cout<<" 7 | 8 | 9           |   | O "<<endl;
  72. cout<<"   |   |             |   |  "<<endl;
  73. cout<<"gane "<<endl;
  74. }
  75. if(r[2]=='7')
  76. {
  77. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  78. cout<<"   |   |             |   |    "<<endl;
  79. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  80. cout<<"___|___|___       ___|___|___"<<endl;
  81. cout<<"   |   |             |   |   "<<endl;
  82. cout<<" 4 | 5 | 6           |   | O"<<endl;
  83. cout<<"___|___|___       ___|___|___ "<<endl;
  84. cout<<"   |   |             |   |  "<<endl;
  85. cout<<" 7 | 8 | 9         X |   | O "<<endl;
  86. cout<<"   |   |             |   |  "<<endl;
  87. cout<<" gane "<<endl;
  88. }
  89. if(r[2]=='8')
  90. {
  91. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  92. cout<<"   |   |             |   |    "<<endl;
  93. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  94. cout<<"___|___|___       ___|___|___"<<endl;
  95. cout<<"   |   |             |   |   "<<endl;
  96. cout<<" 4 | 5 | 6           |   | O "<<endl;
  97. cout<<"___|___|___       ___|___|___ "<<endl;
  98. cout<<"   |   |             |   |  "<<endl;
  99. cout<<" 7 | 8 | 9           | X | O "<<endl;
  100. cout<<"   |   |             |   |  "<<endl;
  101. cout<<" gane "<<endl;
  102. }
  103. if(r[2]=='6')
  104. {
  105. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  106. cout<<"   |   |             |   |    "<<endl;
  107. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  108. cout<<"___|___|___       ___|___|___"<<endl;
  109. cout<<"   |   |             |   |   "<<endl;
  110. cout<<" 4 | 5 | 6           |   | X "<<endl;
  111. cout<<"___|___|___       ___|___|___ "<<endl;
  112. cout<<"   |   |             |   |  "<<endl;
  113. cout<<" 7 | 8 | 9         O |   | O "<<endl;
  114. cout<<"   |   |             |   |  "<<endl;
  115. cin>>r[3];
  116. if(r[3]=='5')
  117. {
  118. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  119. cout<<"   |   |             |   |    "<<endl;
  120. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  121. cout<<"___|___|___       ___|___|___"<<endl;
  122. cout<<"   |   |             |   |   "<<endl;
  123. cout<<" 4 | 5 | 6           | X | X "<<endl;
  124. cout<<"___|___|___       ___|___|___ "<<endl;
  125. cout<<"   |   |             |   |  "<<endl;
  126. cout<<" 7 | 8 | 9         O | O | O "<<endl;
  127. cout<<"   |   |             |   |  "<<endl;
  128. cout<<" gane "<<endl;
  129. }
  130. if(r[3]=='8')
  131. {
  132. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  133. cout<<"   |   |             |   |    "<<endl;
  134. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  135. cout<<"___|___|___       ___|___|___"<<endl;
  136. cout<<"   |   |             |   |   "<<endl;
  137. cout<<" 4 | 5 | 6           | O | X "<<endl;
  138. cout<<"___|___|___       ___|___|___ "<<endl;
  139. cout<<"   |   |             |   |  "<<endl;
  140. cout<<" 7 | 8 | 9         O | X | O "<<endl;
  141. cout<<"   |   |             |   |  "<<endl;
  142. cout<<" gane "<<endl;
  143. }
  144. if(r[3]=='4')
  145. {
  146. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  147. cout<<"   |   |             |   |    "<<endl;
  148. cout<<" 1 | 2 | 3         X | X | O "<<endl;
  149. cout<<"___|___|___       ___|___|___"<<endl;
  150. cout<<"   |   |             |   |   "<<endl;
  151. cout<<" 4 | 5 | 6         X | O | X "<<endl;
  152. cout<<"___|___|___       ___|___|___ "<<endl;
  153. cout<<"   |   |             |   |  "<<endl;
  154. cout<<" 7 | 8 | 9         O |   | O "<<endl;
  155. cout<<"   |   |             |   |  "<<endl;
  156. cout<<" gane "<<endl;
  157. }
  158. }
  159. }
  160. if(r[1]=='3')
  161. {//if del 1-3
  162. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  163. cout<<"   |   |             |   |    "<<endl;
  164. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  165. cout<<"___|___|___       ___|___|___"<<endl;
  166. cout<<"   |   |             |   |   "<<endl;
  167. cout<<" 4 | 5 | 6           |   |   "<<endl;
  168. cout<<"___|___|___       ___|___|___ "<<endl;
  169. cout<<"   |   |             |   |  "<<endl;
  170. cout<<" 7 | 8 | 9           |   | O "<<endl;
  171. cout<<"   |   |             |   |  "<<endl;
  172. cin>>r[2];
  173. if(r[2]=='8')
  174. {//if del 1-3-7
  175. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  176. cout<<"   |   |             |   |    "<<endl;
  177. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  178. cout<<"___|___|___       ___|___|___"<<endl;
  179. cout<<"   |   |             |   |   "<<endl;
  180. cout<<" 4 | 5 | 6           | O |     "<<endl;
  181. cout<<"___|___|___       ___|___|___ "<<endl;
  182. cout<<"   |   |             |   |  "<<endl;
  183. cout<<" 7 | 8 | 9           | X | O "<<endl;
  184. cout<<"   |   |             |   |  "<<endl;
  185. cin>>r[3];
  186. if(r[3]=='4')
  187. {
  188. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  189. cout<<"   |   |             |   |    "<<endl;
  190. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  191. cout<<"___|___|___       ___|___|___"<<endl;
  192. cout<<"   |   |             |   |   "<<endl;
  193. cout<<" 4 | 5 | 6         X | O |    "<<endl;
  194. cout<<"___|___|___       ___|___|___ "<<endl;
  195. cout<<"   |   |             |   |  "<<endl;
  196. cout<<" 7 | 8 | 9         O | X | O "<<endl;
  197. cout<<"   |   |             |   |  "<<endl;
  198. cout<<" empate "<<endl;
  199. }
  200. if(r[3]=='7')
  201. {
  202. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  203. cout<<"   |   |             |   |    "<<endl;
  204. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  205. cout<<"___|___|___       ___|___|___"<<endl;
  206. cout<<"   |   |             |   |   "<<endl;
  207. cout<<" 4 | 5 | 6         O | O |  "<<endl;
  208. cout<<"___|___|___       ___|___|___ "<<endl;
  209. cout<<"   |   |             |   |  "<<endl;
  210. cout<<" 7 | 8 | 9         X | X | O "<<endl;
  211. cout<<"   |   |             |   |  "<<endl;
  212. cout<<" empate "<<endl;
  213. if(r[4]=='4')
  214. {
  215. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  216. cout<<"   |   |             |   |    "<<endl;
  217. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  218. cout<<"___|___|___       ___|___|___"<<endl;
  219. cout<<"   |   |             |   |   "<<endl;
  220. cout<<" 4 | 5 | 6         X | O | O "<<endl;
  221. cout<<"___|___|___       ___|___|___ "<<endl;
  222. cout<<"   |   |             |   |  "<<endl;
  223. cout<<" 7 | 8 | 9         X | X | O "<<endl;
  224. cout<<"   |   |             |   |  "<<endl;
  225. }
  226. }
  227. if(r[3]=='6')
  228. {
  229. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  230. cout<<"   |   |             |   |    "<<endl;
  231. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  232. cout<<"___|___|___       ___|___|___"<<endl;
  233. cout<<"   |   |             |   |   "<<endl;
  234. cout<<" 4 | 5 | 6         O | O | X  "<<endl;
  235. cout<<"___|___|___       ___|___|___ "<<endl;
  236. cout<<"   |   |             |   |  "<<endl;
  237. cout<<" 7 | 8 | 9           | X | O "<<endl;
  238. cout<<"   |   |             |   |  "<<endl;
  239. cout<<" empate "<<endl;
  240. }
  241. if(r[4]=='7')
  242. {
  243. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  244. cout<<"   |   |             |   |    "<<endl;
  245. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  246. cout<<"___|___|___       ___|___|___"<<endl;
  247. cout<<"   |   |             |   |   "<<endl;
  248. cout<<" 4 | 5 | 6           | O | X  "<<endl;
  249. cout<<"___|___|___       ___|___|___ "<<endl;
  250. cout<<"   |   |             |   |  "<<endl;
  251. cout<<" 7 | 8 | 9         X | O | O "<<endl;
  252. cout<<"   |   |             |   |  "<<endl;
  253. cout<<" gane "<<endl;
  254. if(r[4]=='4')
  255. {
  256. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  257. cout<<"   |   |             |   |    "<<endl;
  258. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  259. cout<<"___|___|___       ___|___|___"<<endl;
  260. cout<<"   |   |             |   |   "<<endl;
  261. cout<<" 4 | 5 | 6         X | O | X  "<<endl;
  262. cout<<"___|___|___       ___|___|___ "<<endl;
  263. cout<<"   |   |             |   |  "<<endl;
  264. cout<<" 7 | 8 | 9           | O | O "<<endl;
  265. cout<<"   |   |             |   |  "<<endl;
  266. cout<<" gane "<<endl;
  267. if(r[4]=='8')
  268. {
  269. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  270. cout<<"   |   |             |   |    "<<endl;
  271. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  272. cout<<"___|___|___       ___|___|___"<<endl;
  273. cout<<"   |   |             |   |   "<<endl;
  274. cout<<" 4 | 5 | 6         O | O | X  "<<endl;
  275. cout<<"___|___|___       ___|___|___ "<<endl;
  276. cout<<"   |   |             |   |  "<<endl;
  277. cout<<" 7 | 8 | 9           | X | O "<<endl;
  278. cout<<"   |   |             |   |  "<<endl;
  279. cout<<" empate "<<endl;
  280. }
  281. }
  282. }
  283. }
  284. if(r[2]=='6')
  285. {//if del 1-3-7
  286. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  287. cout<<"   |   |             |   |    "<<endl;
  288. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  289. cout<<"___|___|___       ___|___|___"<<endl;
  290. cout<<"   |   |             |   |   "<<endl;
  291. cout<<" 4 | 5 | 6           |   | X   "<<endl;
  292. cout<<"___|___|___       ___|___|___ "<<endl;
  293. cout<<"   |   |             |   |  "<<endl;
  294. cout<<" 7 | 8 | 9         O |   | O "<<endl;
  295. cout<<"   |   |             |   |  "<<endl;
  296. cin>>r[3];
  297. if(r[3]=='5')
  298. {
  299. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  300. cout<<"   |   |             |   |    "<<endl;
  301. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  302. cout<<"___|___|___       ___|___|___"<<endl;
  303. cout<<"   |   |             |   |   "<<endl;
  304. cout<<" 4 | 5 | 6           | X | X  "<<endl;
  305. cout<<"___|___|___       ___|___|___ "<<endl;
  306. cout<<"   |   |             |   |  "<<endl;
  307. cout<<" 7 | 8 | 9         O | O | O "<<endl;
  308. cout<<"   |   |             |   |  "<<endl;
  309. cout<<" gane "<<endl;
  310. }
  311. if(r[3]=='4')
  312. {
  313. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  314. cout<<"   |   |             |   |    "<<endl;
  315. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  316. cout<<"___|___|___       ___|___|___"<<endl;
  317. cout<<"   |   |             |   |   "<<endl;
  318. cout<<" 4 | 5 | 6         X |   | X "<<endl;
  319. cout<<"___|___|___       ___|___|___ "<<endl;
  320. cout<<"   |   |             |   |  "<<endl;
  321. cout<<" 7 | 8 | 9         O | O | O "<<endl;
  322. cout<<"   |   |             |   |  "<<endl;
  323. cout<<" Gane "<<endl;
  324. }
  325. if(r[3]=='8')
  326. {
  327. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  328. cout<<"   |   |             |   |    "<<endl;
  329. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  330. cout<<"___|___|___       ___|___|___"<<endl;
  331. cout<<"   |   |             |   |   "<<endl;
  332. cout<<" 4 | 5 | 6           | O | X "<<endl;
  333. cout<<"___|___|___       ___|___|___ "<<endl;
  334. cout<<"   |   |             |   |  "<<endl;
  335. cout<<" 7 | 8 | 9         O | X | O "<<endl;
  336. cout<<"   |   |             |   |  "<<endl;
  337. cout<<" empate "<<endl;
  338. }
  339. }
  340. if(r[2]=='7')
  341. {//if del 1-3-7
  342. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  343. cout<<"   |   |             |   |    "<<endl;
  344. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  345. cout<<"___|___|___       ___|___|___"<<endl;
  346. cout<<"   |   |             |   |   "<<endl;
  347. cout<<" 4 | 5 | 6           | O |   "<<endl;
  348. cout<<"___|___|___       ___|___|___ "<<endl;
  349. cout<<"   |   |             |   |  "<<endl;
  350. cout<<" 7 | 8 | 9         X |   | O "<<endl;
  351. cout<<"   |   |             |   |  "<<endl;
  352. cin>>r[3];
  353. if(r[3]=='4')
  354. {//1-3-7-4
  355. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  356. cout<<"   |   |             |   |    "<<endl;
  357. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  358. cout<<"___|___|___       ___|___|___"<<endl;
  359. cout<<"   |   |             |   |   "<<endl;
  360. cout<<" 4 | 5 | 6         X | O |   "<<endl;
  361. cout<<"___|___|___       ___|___|___ "<<endl;
  362. cout<<"   |   |             |   |  "<<endl;
  363. cout<<" 7 | 8 | 9         X |   | O "<<endl;
  364. cout<<"   |   |             |   |  "<<endl;
  365. cout<<"Felicidades ganaste "<<endl;
  366. }//1-3-7-4
  367. if(r[3]=='8')
  368. {//1-3-7-8
  369. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  370. cout<<"   |   |             |   |    "<<endl;
  371. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  372. cout<<"___|___|___       ___|___|___"<<endl;
  373. cout<<"   |   |             |   |   "<<endl;
  374. cout<<" 4 | 5 | 6         O | O |  "<<endl;
  375. cout<<"___|___|___       ___|___|___ "<<endl;
  376. cout<<"   |   |             |   |  "<<endl;
  377. cout<<" 7 | 8 | 9         X | X | O "<<endl;
  378. cout<<"   |   |             |   |  "<<endl;
  379. cout<<"empate "<<endl;
  380. }//1-3-7-8
  381. if(r[3]=='6')
  382. {//1-3-7-6
  383. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  384. cout<<"   |   |             |   |    "<<endl;
  385. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  386. cout<<"___|___|___       ___|___|___"<<endl;
  387. cout<<"   |   |             |   |   "<<endl;
  388. cout<<" 4 | 5 | 6         O | O | X "<<endl;
  389. cout<<"___|___|___       ___|___|___ "<<endl;
  390. cout<<"   |   |             |   |  "<<endl;
  391. cout<<" 7 | 8 | 9         X |   | O "<<endl;
  392. cout<<"   |   |             |   |  "<<endl;
  393. cout<<"empate "<<endl;
  394. }//1-3-7-6
  395. }//if del 1-3-7
  396. if(r[2]=='4')
  397. {
  398. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  399. cout<<"   |   |             |   |    "<<endl;
  400. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  401. cout<<"___|___|___       ___|___|___"<<endl;
  402. cout<<"   |   |             |   |   "<<endl;
  403. cout<<" 4 | 5 | 6         X |   |   "<<endl;
  404. cout<<"___|___|___       ___|___|___ "<<endl;
  405. cout<<"   |   |             |   |  "<<endl;
  406. cout<<" 7 | 8 | 9         O |   | O "<<endl;
  407. cout<<"   |   |             |   |  "<<endl;
  408. cin>>r[4];
  409. if(r[4]=='5')
  410. {
  411. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  412. cout<<"   |   |             |   |    "<<endl;
  413. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  414. cout<<"___|___|___       ___|___|___"<<endl;
  415. cout<<"   |   |             |   |   "<<endl;
  416. cout<<" 4 | 5 | 6         X | X |   "<<endl;
  417. cout<<"___|___|___       ___|___|___ "<<endl;
  418. cout<<"   |   |             |   |  "<<endl;
  419. cout<<" 7 | 8 | 9         O | O | O "<<endl;
  420. cout<<"   |   |             |   |  "<<endl;
  421. cout<<" gane "<<endl;
  422. }
  423. if(r[4]=='8')
  424. {
  425. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  426. cout<<"   |   |             |   |    "<<endl;
  427. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  428. cout<<"___|___|___       ___|___|___"<<endl;
  429. cout<<"   |   |             |   |   "<<endl;
  430. cout<<" 4 | 5 | 6         X | O |   "<<endl;
  431. cout<<"___|___|___       ___|___|___ "<<endl;
  432. cout<<"   |   |             |   |  "<<endl;
  433. cout<<" 7 | 8 | 9         O | X | O "<<endl;
  434. cout<<"   |   |             |   |  "<<endl;
  435. cout<<" empate "<<endl;
  436. }
  437. if(r[4]=='6')
  438. {
  439. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  440. cout<<"   |   |             |   |    "<<endl;
  441. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  442. cout<<"___|___|___       ___|___|___"<<endl;
  443. cout<<"   |   |             |   |   "<<endl;
  444. cout<<" 4 | 5 | 6         X |   | X  "<<endl;
  445. cout<<"___|___|___       ___|___|___ "<<endl;
  446. cout<<"   |   |             |   |  "<<endl;
  447. cout<<" 7 | 8 | 9         O | O | O "<<endl;
  448. cout<<"   |   |             |   |  "<<endl;
  449. cout<<"gane "<<endl;
  450. }
  451. }//if 1-3-4
  452. if(r[2]=='5')
  453. {//if del 1-3-7
  454. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  455. cout<<"   |   |             |   |    "<<endl;
  456. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  457. cout<<"___|___|___       ___|___|___"<<endl;
  458. cout<<"   |   |             |   |   "<<endl;
  459. cout<<" 4 | 5 | 6           | X |   "<<endl;
  460. cout<<"___|___|___       ___|___|___ "<<endl;
  461. cout<<"   |   |             |   |  "<<endl;
  462. cout<<" 7 | 8 | 9         O |   | O "<<endl;
  463. cout<<"   |   |             |   |  "<<endl;
  464. cin>>r[4];
  465. if(r[4]=='6')
  466. {
  467. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  468. cout<<"   |   |             |   |    "<<endl;
  469. cout<<" 1 | 2 | 3         X | O | X   "<<endl;
  470. cout<<"___|___|___       ___|___|___"<<endl;
  471. cout<<"   |   |             |   |   "<<endl;
  472. cout<<" 4 | 5 | 6           | X | X  "<<endl;
  473. cout<<"___|___|___       ___|___|___ "<<endl;
  474. cout<<"   |   |             |   |  "<<endl;
  475. cout<<" 7 | 8 | 9         O | O | O "<<endl;
  476. cout<<"   |   |             |   |  "<<endl;
  477. cout<<" gane "<<endl;
  478. }
  479. if(r[4]=='4')
  480. {
  481. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  482. cout<<"   |   |             |   |    "<<endl;
  483. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  484. cout<<"___|___|___       ___|___|___"<<endl;
  485. cout<<"   |   |             |   |   "<<endl;
  486. cout<<" 4 | 5 | 6         X | X |  "<<endl;
  487. cout<<"___|___|___       ___|___|___ "<<endl;
  488. cout<<"   |   |             |   |  "<<endl;
  489. cout<<" 7 | 8 | 9         O | O | O "<<endl;
  490. cout<<"   |   |             |   |  "<<endl;
  491. cout<<" gane "<<endl;
  492. }
  493. if(r[4]=='8')
  494. {
  495. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  496. cout<<"   |   |             |   |    "<<endl;
  497. cout<<" 1 | 2 | 3         X | O | X "<<endl;
  498. cout<<"___|___|___       ___|___|___"<<endl;
  499. cout<<"   |   |             |   |   "<<endl;
  500. cout<<" 4 | 5 | 6           | X | O "<<endl;
  501. cout<<"___|___|___       ___|___|___ "<<endl;
  502. cout<<"   |   |             |   |  "<<endl;
  503. cout<<" 7 | 8 | 9         O | X | O "<<endl;
  504. cout<<"   |   |             |   |  "<<endl;
  505. cout<<" empate "<<endl;
  506. }
  507. }
  508. }//if del 1-3
  509. if(r[1]=='4')
  510. {//if del 1-4
  511. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  512. cout<<"   |   |             |   |    "<<endl;
  513. cout<<" 1 | 2 | 3         X |   |   "<<endl;
  514. cout<<"___|___|___       ___|___|___"<<endl;
  515. cout<<"   |   |             |   |   "<<endl;
  516. cout<<" 4 | 5 | 6         X |   |   "<<endl;
  517. cout<<"___|___|___       ___|___|___ "<<endl;
  518. cout<<"   |   |             |   |  "<<endl;
  519. cout<<" 7 | 8 | 9         O |   | O "<<endl;
  520. cout<<"   |   |             |   |  "<<endl;
  521. cin>>r[1];
  522. }//if del 1-4
  523. } //if del 1-1
  524. if(r[0]=='2')
  525. { //if del 2-1
  526. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  527. cout<<"   |   |             |   |    "<<endl;
  528. cout<<" 1 | 2 | 3           | X |   "<<endl;
  529. cout<<"___|___|___       ___|___|___"<<endl;
  530. cout<<"   |   |             |   |   "<<endl;
  531. cout<<" 4 | 5 | 6           |   |   "<<endl;
  532. cout<<"___|___|___       ___|___|___ "<<endl;
  533. cout<<"   |   |             |   |  "<<endl;
  534. cout<<" 7 | 8 | 9         O |   |  "<<endl;
  535. cout<<"   |   |             |   |  "<<endl;
  536. }  //if del 2-1
  537. if(r[0]=='3')
  538. {//if del 3-1
  539. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  540. cout<<"   |   |             |   |    "<<endl;
  541. cout<<" 1 | 2 | 3           |   | X   "<<endl;
  542. cout<<"___|___|___       ___|___|___"<<endl;
  543. cout<<"   |   |             |   |   "<<endl;
  544. cout<<" 4 | 5 | 6           |   |   "<<endl;
  545. cout<<"___|___|___       ___|___|___ "<<endl;
  546. cout<<"   |   |             |   |  "<<endl;
  547. cout<<" 7 | 8 | 9           |   | O "<<endl;
  548. cout<<"   |   |             |   |  "<<endl;
  549. }  //if del 3-1
  550. if(r[0]=='4')
  551. {//if del 4-1
  552. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  553. cout<<"   |   |             |   |    "<<endl;
  554. cout<<" 1 | 2 | 3           |   | O   "<<endl;
  555. cout<<"___|___|___       ___|___|___"<<endl;
  556. cout<<"   |   |             |   |   "<<endl;
  557. cout<<" 4 | 5 | 6         X |   |   "<<endl;
  558. cout<<"___|___|___       ___|___|___ "<<endl;
  559. cout<<"   |   |             |   |  "<<endl;
  560. cout<<" 7 | 8 | 9           |   |   "<<endl;
  561. cout<<"   |   |             |   |  "<<endl;
  562. }//if del 4-1
  563. if(r[0]=='5')
  564. {//if del 5-1
  565. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  566. cout<<"   |   |             |   |    "<<endl;
  567. cout<<" 1 | 2 | 3           |   | O   "<<endl;
  568. cout<<"___|___|___       ___|___|___"<<endl;
  569. cout<<"   |   |             |   |   "<<endl;
  570. cout<<" 4 | 5 | 6           | X |   "<<endl;
  571. cout<<"___|___|___       ___|___|___ "<<endl;
  572. cout<<"   |   |             |   |  "<<endl;
  573. cout<<" 7 | 8 | 9           |   |  "<<endl;
  574. cout<<"   |   |             |   |  "<<endl;
  575. }//if del 5-1
  576. if(r[0]=='6')
  577. {//if del 6-1
  578. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  579. cout<<"   |   |             |   |    "<<endl;
  580. cout<<" 1 | 2 | 3           |   |   "<<endl;
  581. cout<<"___|___|___       ___|___|___"<<endl;
  582. cout<<"   |   |             |   |   "<<endl;
  583. cout<<" 4 | 5 | 6           |   | X "<<endl;
  584. cout<<"___|___|___       ___|___|___ "<<endl;
  585. cout<<"   |   |             |   |  "<<endl;
  586. cout<<" 7 | 8 | 9         O |   |  "<<endl;
  587. cout<<"   |   |             |   |  "<<endl;
  588. }//if del 6-1
  589. if(r[0]=='7')
  590. {//if del 7-1
  591. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  592. cout<<"   |   |             |   |    "<<endl;
  593. cout<<" 1 | 2 | 3           |   | O   "<<endl;
  594. cout<<"___|___|___       ___|___|___"<<endl;
  595. cout<<"   |   |             |   |   "<<endl;
  596. cout<<" 4 | 5 | 6           |   |   "<<endl;
  597. cout<<"___|___|___       ___|___|___ "<<endl;
  598. cout<<"   |   |             |   |  "<<endl;
  599. cout<<" 7 | 8 | 9         X |   |   "<<endl;
  600. cout<<"   |   |             |   |  "<<endl;
  601. }//if del 7-1
  602. if(r[0]=='8')
  603. {//if del 8-1
  604. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  605. cout<<"   |   |             |   |    "<<endl;
  606. cout<<" 1 | 2 | 3         O |   |     "<<endl;
  607. cout<<"___|___|___       ___|___|___"<<endl;
  608. cout<<"   |   |             |   |   "<<endl;
  609. cout<<" 4 | 5 | 6           |   |   "<<endl;
  610. cout<<"___|___|___       ___|___|___ "<<endl;
  611. cout<<"   |   |             |   |  "<<endl;
  612. cout<<" 7 | 8 | 9           | X |   "<<endl;
  613. cout<<"   |   |             |   |  "<<endl;
  614. }//if del 8-1
  615. if (r[0]=='9')
  616. {//if del 9-1
  617. clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
  618. cout<<"   |   |             |   |    "<<endl;
  619. cout<<" 1 | 2 | 3         O |   |     "<<endl;
  620. cout<<"___|___|___       ___|___|___"<<endl;
  621. cout<<"   |   |             |   |   "<<endl;
  622. cout<<" 4 | 5 | 6           |   |   "<<endl;
  623. cout<<"___|___|___       ___|___|___ "<<endl;
  624. cout<<"   |   |             |   |  "<<endl;
  625. cout<<" 7 | 8 | 9           |   | X "<<endl;
  626. cout<<"   |   |             |   |  "<<endl;
  627. }//if del 9-1
  628.  
  629. }//ciclo del gato
  630. else
  631. {
  632. cout<<"porfavor vuelva a iniciar "<<endl;
  633. }
  634. }
eso es lo que yevo y si siguo asi me saldra muy largo asi que por eso pido su ayuda
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines