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

 

 


Tema destacado: Introducción a Git (Primera Parte)


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación General / Subconsulta en sql server en: 14 Febrero 2017, 09:29 am
Buenas tengo una base de datos para gestionar un alquiler de bicicletas, quiero saber las bicicletas cuya fecha de devolución [FeDev] sea inferior a la fecha actual.

BICICLETA

CREATE TABLE [dbo].[BICICLETA] (
    [IdBici]    NCHAR (10)    NOT NULL,
    [marca]     NVARCHAR (15) NOT NULL,
    [precio]    MONEY         NULL,
    [alquilada] BIT           NULL,
    CONSTRAINT [PK_BICICLETA] PRIMARY KEY CLUSTERED ([IdBici] ASC)
);

ALQUILER
CREATE TABLE [dbo].[ALQUILER] (
    [IdAlquiler] BIGINT     NOT NULL,
    [FeAlquiler] DATE       NULL,
    [FeDev]      DATE       NULL,
    [IdBici]     NCHAR (10) NOT NULL,
    [IdCliente]  NCHAR (20) NOT NULL,
    CONSTRAINT [PK_ALQUILER] PRIMARY KEY CLUSTERED ([IdAlquiler] ASC),
    CONSTRAINT [FK_ALQUILER_BICI] FOREIGN KEY ([IdBici]) REFERENCES [dbo].[BICICLETA] ([IdBici]),
    CONSTRAINT [FK_ALQUILER_CLIENTE] FOREIGN KEY ([IdCliente]) REFERENCES [dbo].[CLIENTE] ([IdCliente])
);
2  Programación / .NET (C#, VB.NET, ASP) / Duda sonre array en zigzag en: 19 Enero 2016, 18:52 pm
[NOTA DEL MODERADOR]
1. Usa las etiquetas GeShi para isnertar código.
2. Publica las preguntas de programación en el subforo correspondiente.
Lee las reglas del foro.



Buenas a todos, aunque no sé si este tema iria aquí.

tengo una duda sobre un programa que imprima una matriz en zig zag así

Código:
1 10 11 20
2 9  12 19
3 8  13 18
4 7  14 17
5 6  15 16

de momento tengo esto pero estoy bloqueado, no se como darle la vuelta cada vez que llegue al final de una columna

Código
  1. const int kfila = 3;
  2.        const int kcolumna = 3;
  3.  
  4.        int[,] matriz = new int[kfila, kcolumna];
  5.  
  6.  
  7.  
  8.        void leermatriz(int[,] matriz)
  9.        {
  10.            int i, j;
  11.  
  12.            for (i = 0; i < matriz.GetLength(0); i++)
  13.                for (j = 0; j < matriz.GetLength(1); j++)
  14.                    matriz[i, j] = int.Parse(InputBox("elemento[" + i + " , " + j + "]"));
  15.        }
  16.        string mostrarmatriz(int[,] matriz)
  17.        {
  18.            int i, j;
  19.            string texto;
  20.            texto = "Los valores de la matriz son:\n";
  21.  
  22.            for (j = 0; j < matriz.GetLength(1); j++)
  23.            {
  24.  
  25.                for (i = 0; i < matriz.GetLength(0); i++)
  26.                    for (i = matriz.GetLength(0) - 1; i >= 0; i--)
  27.                        texto = texto + matriz[i, j] + ", ";
  28.                texto = texto + "\n"; // Retorno de carro al terminar cada fila
  29.            }
  30.            return texto;
  31.        }

Solo pido saber como le doy la vuelta para que continue en la columna siguiente, un saludo. y gracias
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines