Mostrando entradas con la etiqueta HUGO ARELLANO. Mostrar todas las entradas
Mostrando entradas con la etiqueta HUGO ARELLANO. Mostrar todas las entradas

lunes, 26 de septiembre de 2011

MOSTRAR EN PANTALLA UNA FIGURA EN ENSAMBLADOR



CÓDIGO DEL PROGRAMA
page 60, 132
title figu
;--------------------

pila segment para stack 'stack'
DB 12 dup ('pilapila')
pila ends
;--------------------

dato segment para 'data'
; figu es la figura que se va a mostrar en pantalla, cada linea comienza con DB y termina con 0ah,0dh para
; salto del inea, al final de la figura va el caracter $ para indicar que termina la figura
figu DB '    \\\ ',0ah,0dh
                 DB '     \\\\\\ ',0ah,0dh
                 DB '      \(0)/ ',0ah,0dh
                 DB '     (/ \ ',0ah,0dh
                 DB '     /\  \ ',0ah,0dh
                 DB '    ///   \ ',0ah,0dh
                 DB '   ///|   | ',0ah,0dh
                 DB '  ////|   | ',0ah,0dh
                 DB ' //////   / ',0ah,0dh
                 DB '  |////  /_ ',0ah,0dh
                 DB ' /|///_ _ _/ ',0ah,0dh
                 DB '//\/|     | ',0ah,0dh
                 DB '__////____\__\_______ ',0ah,0dh
                 DB '_____________________ ',0ah,0dh
                 DB '    ||       || ',0ah,0dh
     DB '    ||       ||','$'
dato ends
;--------------------

codigo segment para 'code'
inicio proc far
assume cs: codigo, ds:dato, es:dato, ss:pila
push ds
sub ax, ax
push ax
mov ax, dato
mov ds, ax
mov es, ax
;-------------------- PROGRAMA PRINCIPAL -------------------
mov ah,09; funcion 09 envio de una cadena de caracteres en este caso es nuestra figura de nombre figu
mov dx,offset figu
int 21h
;------------
fin:;etiqueta fin
nop;no realiza instruccion
;-------------------------- END PP -------------------------
ret
inicio endp
codigo ends
end inicio



ENSAMBLADO, ENLACE Y EJECUCIÓN USANDO TASM Y TLINK


viernes, 26 de agosto de 2011

ORDENAR NOMBRE Y EDAD DE MENOR A MAYOR CON METODO BURBUJA



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ordenar_nombres_burbuja_
{
    class Program
    {
        static void Main(string[] args)
        {

 //EL TAMAÑO DEL ARREGLO ES DE 5 POR LO SOLO PODEMOS AGREGAR A 5 PERSONAS
            int temp;
            int[]edad=new int[5];
            string[] nombre = new string[5];
            for (int i = 0; i < edad.Length; i++)
            {
                Console.WriteLine("dame el nombre ["+i+"]");
                nombre[i]=Console.ReadLine();
                   Console.WriteLine("dame su edad:");
                edad[i]=Convert.ToInt32(Console.ReadLine());
                  }
            string seudo;

         //METODO BURBUJA
             for (int i = 0; i < (edad.Length-1); i++)
            {
                 for (int j = 0; j < (edad.Length-1); j++)
                  {
                     if(edad[j]>edad[j+1])
                     {
                         temp=edad[j];
                         seudo = nombre[j];
                         edad[j]=edad[j+1];
                         nombre[j] = nombre[j + 1];
                         edad[j+1]=temp;
                         nombre[j + 1] = seudo;
                        
                     }
                 }
                   
                  }
 //SE IMPRIMEN LAS PERSONAS SEGUN LA EDAD DE MENOR A MAYOR
                 Console.WriteLine("orden:");
                 for (int p = 0; p < edad.Length; p++)
            {
                Console.WriteLine(nombre[p]+":"+edad[p]);
           
               
            }
                 Console.ReadLine();
        }
          
        }
    }