Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Temas - sagoky

#1
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:
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
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:


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 C/C++ / turbo c++ ayuda con el gato
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
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int g;
char r[100];
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3           |   |   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   |  "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[0];
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)
{//ciclo del gato
if(r[0]=='1')
{//if del 1-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X |   |   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[1];
if(r[1]=='2')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   | O"<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[2];
if(r[2]=='4')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X |   | O "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<"gane ^^ "<<endl;
}
if(r[2]=='5')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | X | O "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<"gane "<<endl;
}
if(r[2]=='7')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   | O"<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
if(r[2]=='8')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   | O "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
if(r[2]=='6')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   | X "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[3];
if(r[3]=='5')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | X | X "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
if(r[3]=='8')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | O | X "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
if(r[3]=='4')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | X | O "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
}
}
if(r[1]=='3')
{//if del 1-3
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[2];
if(r[2]=='8')
{//if del 1-3-7
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | O |     "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[3];
if(r[3]=='4')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X | O |    "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" empate "<<endl;
}
if(r[3]=='7')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         O | O |  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" empate "<<endl;
if(r[4]=='4')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X | O | O "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
}
}
if(r[3]=='6')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         O | O | X  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" empate "<<endl;
}
if(r[4]=='7')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | O | X  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
if(r[4]=='4')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X | O | X  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
if(r[4]=='8')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         O | O | X  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" empate "<<endl;
}
}
}
}
if(r[2]=='6')
{//if del 1-3-7
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   | X   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[3];
if(r[3]=='5')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | X | X  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
if(r[3]=='4')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X |   | X "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" Gane "<<endl;
}
if(r[3]=='8')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | O | X "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" empate "<<endl;
}
}
if(r[2]=='7')
{//if del 1-3-7
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | O |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[3];
if(r[3]=='4')
{//1-3-7-4
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X | O |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<"Felicidades ganaste "<<endl;
}//1-3-7-4
if(r[3]=='8')
{//1-3-7-8
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         O | O |  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<"empate "<<endl;
}//1-3-7-8
if(r[3]=='6')
{//1-3-7-6
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         O | O | X "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<"empate "<<endl;
}//1-3-7-6
}//if del 1-3-7
if(r[2]=='4')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[4];
if(r[4]=='5')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X | X |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
if(r[4]=='8')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X | O |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" empate "<<endl;
}
if(r[4]=='6')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X |   | X  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<"gane "<<endl;
}
}//if 1-3-4
if(r[2]=='5')
{//if del 1-3-7
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | X |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[4];
if(r[4]=='6')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | X | X  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
if(r[4]=='4')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X | X |  "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | O | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" gane "<<endl;
}
if(r[4]=='8')
{
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X | O | X "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | X | O "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O | X | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" empate "<<endl;
}
}
}//if del 1-3
if(r[1]=='4')
{//if del 1-4
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         X |   |   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
cin>>r[1];
}//if del 1-4
} //if del 1-1
if(r[0]=='2')
{ //if del 2-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3           | X |   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O |   |  "<<endl;
cout<<"   |   |             |   |  "<<endl;
}  //if del 2-1
if(r[0]=='3')
{//if del 3-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3           |   | X   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   | O "<<endl;
cout<<"   |   |             |   |  "<<endl;
}  //if del 3-1
if(r[0]=='4')
{//if del 4-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3           |   | O   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6         X |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   |   "<<endl;
cout<<"   |   |             |   |  "<<endl;
}//if del 4-1
if(r[0]=='5')
{//if del 5-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3           |   | O   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           | X |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   |  "<<endl;
cout<<"   |   |             |   |  "<<endl;
}//if del 5-1
if(r[0]=='6')
{//if del 6-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3           |   |   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   | X "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         O |   |  "<<endl;
cout<<"   |   |             |   |  "<<endl;
}//if del 6-1
if(r[0]=='7')
{//if del 7-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3           |   | O   "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9         X |   |   "<<endl;
cout<<"   |   |             |   |  "<<endl;
}//if del 7-1
if(r[0]=='8')
{//if del 8-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         O |   |     "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           | X |   "<<endl;
cout<<"   |   |             |   |  "<<endl;
}//if del 8-1
if (r[0]=='9')
{//if del 9-1
clrscr();cout<<"   teclas            juego "<<endl;cout<<" "<<endl;
cout<<"   |   |             |   |    "<<endl;
cout<<" 1 | 2 | 3         O |   |     "<<endl;
cout<<"___|___|___       ___|___|___"<<endl;
cout<<"   |   |             |   |   "<<endl;
cout<<" 4 | 5 | 6           |   |   "<<endl;
cout<<"___|___|___       ___|___|___ "<<endl;
cout<<"   |   |             |   |  "<<endl;
cout<<" 7 | 8 | 9           |   | X "<<endl;
cout<<"   |   |             |   |  "<<endl;
}//if del 9-1

}//ciclo del gato
else
{
cout<<"porfavor vuelva a iniciar "<<endl;
}
getch();
}

eso es lo que yevo y si siguo asi me saldra muy largo asi que por eso pido su ayuda