domingo, 7 de julio de 2019

Ejercicios Link Unidad No.3 Lenguaje Ensamblador

https://mega.nz/#F!30lAhSCB!eJSPm_L1GaETO7qZ1FmiQg

*Cambia todas las letras a minúsculas
*CBW Y CWD
*Definición del Segmento de datos
*Desactiva interrupciones RTC
*Devuelve la primera posición
*Dibuja con carácter V
*Factorial de 3
*Guarda el estado de la pantalla
*Instrucción AAA
*Instrucción AAM
*Limpia la pantalla la deja azul y carácter rojo
*Memoria Vídeo
*Mensaje en Pantalla
*Mismo C en las 2000 posiciones
*Muestra sucesión de códigos ASCI
*Pide Funciones
*Pide Nombre
*Pregunta a los usuarios si desea continuar
*Tabla Caracteres ASCI
*Últimos Caracteres muestra ETSI

sábado, 6 de julio de 2019

Exámenes Unidad No.3 Lenguaje Ensamblador

Todos los exámenes son de la pagina: https://www.daypo.com/




Ensamblador Parcial 1: Examen  9 de 10 aciertos Primer Intento


Ensamblador Parcial 1: Examen No. 2 9 de 10 aciertos Segundo Intento



Fundamentos Ensamblador: Examen No.3 13 de 13 aciertos Tercer Intento



Lenguaje Ensamblador: Examen No.4 12 de 13 aciertos Segundo Intento


Ejercicios en CLASE Lenguaje Ensamblador(Primera Parte)

ASCI
Código:
.model small
.stack 64
.code
begin: jmp short princi
char db 00,'$'
princi proc far
call b10clr
call c10set
call d10disp
mov ah,4ch
int 21h
princi endp
b10clr: mov ax,0600h
mov bh,07
mov cx,0000
mov dx,184fh
int 10h
ret
c10set: mov ah,02h
mov bh,00
int 10h
ret
d10disp: mov cx,256
lea dx,char
d20: mov ah,09h
int 21h
inc char
loop d20
ret
end begin


Calculadora
Código:
.model small
.stack 100
.data
m1 db 'Ingrese Numero 1: ','$'
m2 db 13,10,'Ingrese Numero 2: ','$'
m3 db 13,10,'Suma: ','$'
m4 db 13,10,'Resta: ','$'
m5 db 13,10,'Multiplicacion: ','$'
m6 db 13,10,'Division: ','$'
linea db 13,10,'$'
var1 db 0
var2 db 0
.code
.startup

call limpia
mov ah,09h
lea dx, m1 ;desplegar numero 1:
int 21h

call leer ;lee primer numero
sub al,30h ;restar 30h para obtener el numero
mov var1,al ;lo guardo en var1
mov ah,09h
lea dx, m2 ;desplegar numero 2:
int 21h

call leer ;lee segundo numero
sub al,30h ;restar 30h para obtener segundo valor
mov var2,al ;guardar en var2
mov bl,var2 ;mover a bl

;******* SUMA
add bl,var1 ; realizo la suma de var2(bl) y var1 y el resultado queda en bl
mov ah,09h
lea dx,m3 ;imprimir suma
int 21h
mov dl,bl ;pongo en dl el numero a imprimir var2(bl)
add dl,30h ; agrego 30h para obtener el caracter   
mov ah,02h ;imprime un caracter
int 21h

;********RESTA
mov bl,var1
sub bl,var2
mov ah,09h
lea dx,m4 ;desplegar resta:
int 21h
mov dl,bl ;mover resta a dl para imprimir
add dl,30h ;sumar 30 para obtener caracter
mov ah,02h ;imprimir un caracter
int 21h

;********MULTIPLICACION
mov ah,09h
lea dx,m5 ;desplegar mult
int 21h

mov al,var1
mov bl,var2
mul bl ;mult al=al*bl
mov dl,al ;mover al a dl para imprimir
add dl,30h ;sumar 30 para obtener caracter
mov ah,02h ;imprimir caracter
int 21h

;*******DIVISION
mov ah,09h
lea dx,m6 ;desplegar div
int 21h
xor ax,ax ;limpiamos el registro ax.
mov al,var2
mov bl,al
mov al,var1
div bl ; divide AX/BX el resultado lo almacena en AX, el residuo queda en DX
mov bl,al
mov dl,bl
add dl,30h
mov ah,02h
int 21h
.exit

; ******PROCEDIMIENTOS
salto proc near
mov ah,09h
lea dx,linea
int 21h
mov dl,00h
ret
salto endp

leer proc near
mov ah,01h;leer caracter desde el teclado
int 21h;lee primer caracter
ret
leer endp

limpia proc near
mov ah,00h
mov al,03h
int 10h
ret
limpia endp
end

Cambia el color de fondo
Código:
.model small
.stack 100
.code
princi proc far
mov ax,@data
mov ds,ax
xor bx,bx
xor cx,cx
mov cx,0
mov bh,07h
otro:
mov ax,0600h
mov cx,0000h
mov dx,184fh
int 10h ;manipula pantalla
mov ah,10h
int 16h ;manipula el teclado
add bh,10h
cmp bh,77h
jle otro
mov ah,4ch
int 21h
princi endp
end princi

Carácter con Movimiento de Flechas
Código:
prog segment para public 'code'
    assume cs:prog,ss:prog,ds:prog
    org 100h
    ini: jmp codigo
    car db 0
    pox db 0
    poy db 0
    xa db 0
    ya db 0
    aviso db 'escriba un caracter y mueva con flechas:','$'
    codigo: mov ah,02h
    mov bh,00h
    mov dh,5
    mov dl,5
    int 10h
    mov ah,9
    mov dx,offset aviso
    int 21h
    mov ah,01h
    int 21h
    mov car,al
    mov ah,03h
    mov bh,00h
    int 10h
    mov pox,ch
    mov poy,dh
    dec pox
    mov ah,05h
    mov al,01h
    int 10h
    bucle: mov ah,02h
    mov bh,01h
    mov dh,ya
    mov dl,xa
    int 10h
    mov ah,02h
    mov dl,32
    int 21h
    mov ah,02h
    mov bh,01h
    mov dh,poy
    mov dl,pox
    int 10h
    mov ah,02h
    mov dl,car
    int 21h
    mov ah,02h
    mov bh,01h
    mov dh,poy
    mov dl,pox
    int 10h
    mov xa,dl
    mov ya,dh
    mov ah,00h
    int 10h
    cmp ah,75
    jnz noleft
    dec pox
    jmp bucle
    noleft: cmp ah,72
    jnz nodown
    dec poy
    jmp bucle
    nodown: cmp ah,72
    jnz noright
    inc pox
    jmp bucle
    noright: cmp ah,80
    jnz noup
    inc poy
    jmp bucle
    noup: cmp al,27
    jz fin
    jmp bucle
    fin: mov ah,4ch
    mov al,00h
    int 21h
prog ends
end ini

Color de una Letra
Código:
.model small
.stack 64
.code
ini: princi  proc far
mov ax,@data
mov ds,ax
mov bx,0700h
mov cx,2000
cmp al,7
je datos_ok
mov bx,0b80h
cmp al,3
je paint_color
cmp al,2
je paint_color
cmp al,2
je paint_color
mov cx,1000
cmp al,1
jbe paint_color
mov al,1
jmp final
paint_color: mov ax,4ch
mov ds,ax
mov ax,ds:[4ch]
;str ax,1
add bx,ax
datos_ok: mov ds,bx
xor bx,bx
otra_letra:
cmp byte ptr[bx],'a'
jb no_min
cmp byte ptr[bx],'z'
ja no_min
and byte ptr[bx],0dfh
no_min:
add bx,2
loop otra_letra
mov al,0
final: mov ah,4ch
int 21h
princi endp
end ini

Cuadro con Símbolos
Código:
.model small
.stack 500h
.data
m1 db 13,10,'?'
db 70 dup('?')
db '?$'
m2 db 13,10,'?'
db 70 dup(' ')
db '?$'
m3 db 13,10,'?'
db 70 dup('?')
db '?$'
.code
cuadro:
mov ax,@data
mov ds,ax
mov dx,offset m1
mov ah,9
int 21h
mov cx,19
for:
dec cx
je salir
call ciclo
jmp for
salir:
mov dx,offset m3
mov ah,9
int 21h
mov ax,4c00h
int 21h
ciclo proc
mov dx,offset m2
mov ah,9
int 21h
ret
ciclo endp
end cuadro

Gráfica
Código:
.model small
.stack 100h
.data
grafica db 24 dup(204,79 dup(?)),200,79 dup(202),'$'
punto db ?
x db ?
y db ?
.code
ini:
mov ax,@data
mov ds,ax
mov dx,offset grafica
mov ah,9
int 21h
mov cx,20
for:
dec cx
cmp cx,0
je salir
jmp rand
puntos:
mov ah,02h
mov dh,y
mov dl,x
int 10h
lea dx,puntos
int 21h
jmp for
mov x,2
mov y,5
rand:
add x,5
mov y,8
mul x
mov y,13
clc
add x,6
adc x,0
jmp puntos
salir:
mov ax,4c00h
int 21h
end ini


HOLA MUNDO
Código:
.model small
.stack
.data
hola db 10, 13,'xxxholamundo',10,13,'$'
.code
inicio:
mov dx,offset hola
mov ah,9
int 21h
end inicio

Limpia en Pantalla
Código:
fin_4c00h equ 4c00h
dos_21h equ 21h
bios_10h equ 10h
pila segment stack
    dw 100 dup('0')
pila ends
codigo segment
    cls proc far
    assume cs:codigo,ss:pila;ds:datos
    ;call limpia
    mov ax,fin_4c00h
    int dos_21h
    cls endp
    limpia proc far
    mov ax,0600h
    mov bh,ah
    mov cx,000h
    mov dx,484fh
    int bios_10h
    ret
    limpia endp
codigo ends
end cls

Limpia Datos
Código:
.model small
.code
programa:
mov AX,4C00H
int 21H
.stack
end programa

Limpia Texto
Código:
.model small
.stack 100h
.data
pantalla equ 0b800h
espacio equ ' '
.code
inicio:
mov ax,pantalla
mov es,ax
xor di,di
mov cx,2000
mov al,espacio
ciclo:
mov es:[di],al
add di,2
dec cx
cmp cx,0
jne ciclo
mov ah,4ch
int 21h
end inicio

Linea de Colores
Código:
.model small
.stack 100h
.data
ms db 13,10,'presione tecla para continuar...$'
.code
inicio:
mov ax,@data
mov ds,ax
mov ax,12h
int 10h
mov dx,50
ciclo:
mov cx,99
add dx,50
call linea
cmp dx,250
jle ciclo
jmp fin
linea:
inc cx
mov ah,0ch
mov al,11 ;cambia el color de la linea
int 10h
cmp cx,300
jne linea
ret
fin:
mov ah,9
mov dx,offset ms
int 21h
mov ah,00
int 16h
mov ax,02h
int 10h
mov ah,4ch
int 21h
end inicio

Mensaje en Pantalla
Código:
.model small
.code
programa:
mov ax,@data
mov dx, ax
mov ah, 9
int 21h
.data
texto db 'mensaje en pantalla...$'
.stack
end programa

Menú
Código:
.model small
.stack 100h
.data
m db 13,10,'..........','$'
m1 db 13,10,'*********,$'
e db 13,10,'...error...$'
menu db 13,10,'     menu    '
db  13,10,'1) imprimir a impresora'
db 13,10,'2) desplegar en pantalla'
db 13,10,'3) salir'
db 13,10,'......opcion(1,2,3):$'
.code
ini:
mov ax,@data
mov ds,ax
menu1:
mov dx,offset menu
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,49
je impresora
cmp al,50
je pantalla
cmp al,51
je salir
jmp error
impresora:
mov bx,0
call imprimir
jmp menu1
error:
mov dx,offset e
mov ah,9
int 21h
jmp menu1
salir:
mov ah,4ch
int 21h
pantalla:
call pantalla1
jmp menu1
pantalla1 proc
mov dx,offset m1
mov ah,9
int 21h
ret
pantalla1 endp
imprimir proc
lea dx,m
mov dx,00h
mov ah,01h
int 17h
repetir:
mov al,m[bx]
cmp al,'$'
je regreso
mov ah,00h
int 17h ;libreria de impresion
inc bx
jmp repetir
regreso: ret
imprimir endp
end ini


Modo VGA y Texto
Código:
.model small
.stack 100h
.data
m db 'pulse S para salir...',13,10,'$'
m1 db 'modo VGA...',13,10,'$'
m2 db 'modo texto...',13,10,'$'
.code
ini:
call VGA
tecla:
mov ax,@data
mov ds,ax
mov dx,offset m
int 21h
mov ah,00
int 16h
cmp al,'S'
je salir
jne tecla
ret
salir:
call texto
mov ah,4ch
int 21h
VGA:
mov ax,06h
int 10h
mov ax,@data
mov ds,ax
mov ah,9
mov dx,offset m1
int 21h
ret
texto:
mov ax,02h
int 10h
mov ax,@data
mov ds,ax
mov ah,9
mov dx,offset m2
int 21h
ret
end ini



Otro Hola Mundo
Código:
cr equ 13
lf equ 0ah
datos segment
    mensaje db,lf,'...hola mundo!',cr,lf,'$'
datos ends
pila segment stack
    db 64 dup('pila')
pila ends
codigo segment
    holam proc far
    assume cs:codigo,ds:datos,ss:pila
    mov ax,datos
    mov ds,ax
    lea dx,mensaje
    mov ah,9
    int 21h
    holam endp
codigo ends
end holam



SALUDO
Código:
datos segment
    saludo db "hola mundo!!";"$"
datos ends
code segment
        assume cs:code,ds:datos
        start:
        start proc
        mov ax,datos
        mov ds,ax
        mov dx,offset saludo
        mov ah,9
        int 21h
        mov ax,4c00h
        int 21h
        start endp
    code ends
    end start



Otro tipo de Hola Mundo
Código:
.model small
.stack 100h
.data
s1 db 'hola mundo','$'
s2 db 'h','o','l','a',' ','m','u','n','d','o','$'
s3 db 48h,6fh,6ch,61h, 20h,4dh,75h,6eh,64h,6fh,24h,'$'
s4 db 0dh,0ah,'hola mundo',0dh,0ah,'$'
.code
ini:
mov ax,@data
mov ds,ax
mov ah,9
mov dx,offset s1
int 21h
lea dx,s2
int 21h
lea dx,s3
int 21h
lea dx,s4
int 21h
mov ah,4ch
int 21h
end ini




RESTA
Código:
.model small
.stack 100h
.data
t1 db ?,'$'
res db ?,'$'
v1 db 13,10,'introduce valor1:','$'
v2 db 13,10,'introduce valor2:','$'
resp db 13,10,'la respuesta es:','$'
.code
inicio:
mov ax,@data
mov ds,ax
mov dx,offset v1
mov ah,9
int 21h
mov ah,1
int 21h
mov t1,al
mov ah,9
mov dx,offset v2
int 21h
mov ah,1
int 21h
sub al,t1
add al,48
mov res,al
mov ah,9
mov dx,offset resp
int 21h
mov ah,9
mov dx,offset res
int 21h
mov ah,4ch
int 21h
end inicio




SÍMBOLOS
Código:
.model small
.stack 100h
.data
t db 201,70 dup(203),107,'$'
t1 db 22 dup(186,78 dup(' '),106),'$'
t2 db 200,78 dup(205),200,'$'
.code
prog:
mov ax,@data
mov ds,ax
mov ah,9
mov dx,offset t
int 21h
lea dx,t1
int 21h
lea dx,t2
int 21h
mov ah,4ch
int 21h
end prog




SUMA
Código:
.model small
.stack
.data
a dw 250
b dw 125
c dw ?
.code
uno:
begin proc far
mov ax,@data
mov ax,a
mov ah,9
int 21h
mov ah,1
int 21h
add ax,b
mov ah,9
int 21h
mov ah,1
int 21h
mov c,ax
mov ah,9
int 21h
mov ax,4c00h
int 21h
begin endp
end uno

lunes, 1 de julio de 2019

Ejercicios LINKS

https://mega.nz/#F!CwFEgCxZ!VQXa8Fm5SB-ILJZzvFyB8A

Algunos de los ejercicios hechos por el programa de C# que se encuentran en el link de mega son:

*INVERTIR NUMERO DE 2 CIFRAS
*INVERTIR NUMERO DE 3 CIFRAS
*OPERACIONES BÁSICAS
*COMPRA RESTAURANTE
*FUNCIONES BÁSICAS LIBRERÍA MATH.
*FORMATO DE SALIDA
*EJERCICIO PROPUESTO NO.1
*MAYOR DE 2 NÚMEROS
*MAYOR DE 3 NÚMEROS
*DESGLOSE DE BILLETES
*BONO DEL EMPLEADO POR HIJO
*NUMERO INTERMEDIO
*TARIFA TELEFÓNICA
*TRIÁNGULOS
*EJERCICIO PROPUESTO NO.2
*DÍA DE LA SEMANA
*ESTADO CIVIL
*CALIFICACIÓN
*EJERCICIO PROPUESTO NO.3
*TABLA DE MULTIPLICAR
ENTRE OTROS.

Examenes Unidad No.2

Cuestionario Programación No.1 10 de 10 Primer intento



Cuestionario Programación No.2 9 de 10 Segundo Intento



Examen Viralizalo 8 de 8 Segundo Intento


Test Programación C++ No.1 13 de 13 Primer Intento


Ejercicios En Clase

Arreglo
Código:

#include <iostream>
using namespace std;

int main()
{
int filas, columnas;
char elcar;
cout << "¿Cuantas filas?:\t";
cin >> filas;
cout << "¿Cuantas columnas?:\t";
cin >> columnas;
cout << "¿Que caracter?:\t";
cin >> elcar;
for (int i = 0; i < filas; i++)
{
for (int j = 0; j < columnas; j++)
cout << elcar;
cout << "\n";
}
return 0;

   
}


Arreglos de Capturas
Código:

#include <iostream>

using namespace std;


int main()

{
int edad[10], i;
for (int i = 0; i < 10; i++)
{
cout << "Introduzca edad:\t";
cin >> edad[i];
}
for (i = 0; i < 10; i++)
cout << "las edades son" << edad[i] << endl;
system("pause");
return 0;


   
}

Arreglos de Funciones
Código:

#include <iostream>

using namespace std;

 int const LONG = 16;

int main ()
{
int lista[LONG] = { 5, 2, 4, 9, 14, 4, 3, 2, 85, 11, 45, 25, 12, 45, 6, 99 };
int valor_mayor, i;
valor_mayor = lista[0];
for (i = 0; i< LONG; i++)
{
if (lista[i] > valor_mayor)
{
valor_mayor = lista[i];
}
cout << "El numero mayor de la lista es";
cout << valor_mayor << "\n";
system("pause");

}


Calificación
Código:

#include <iostream>

using namespace std;


int main()
{
char nota;
    cout << "Introduzca valor (A-H) y pulse Intro";
cin >> nota;

switch (nota)
{
case 'A': cout << "Excelente "
<< "Examen superado \n";
break;
case 'B': cout << "Notable";
cout << "Suficiencia\n";
break;
case 'C': cout << "Aprobado\n";
break;
case 'D':
case 'F': cout << "Suspendido\n";
break;
default:
cout << "no es posible esta nota";
}
cout << "Final de programa" << endl;

return 0;



}

Clase
Código:

#include <stdlib.h>

double base = 5.0;
int radio = 2.0;
using namespace std;

void main()
{
cout << "El valor de base es=\t" << base << endl;
cout << "La direccion de base:\t " << &base << endl;
cout << "El tamano base:\t" << sizeof(double) << endl;
"BYTES\n";
cout << "Valor del radio:" << radio << endl;
cout << "Direccion radio es:" << &radio << endl;
cout << "El tamano del radio es:" << sizeof(int) << endl;
"BYTES\n";
system("pause");




}


Cualquier Valor numérico introducido es positivo
Código:

#include <iostream>
#include <string>

using namespace std;

int main()
{
cout << "introduce un numero:\t";
int valor;
cin >> valor;
if (valor < 0);
valor = -valor;
cout << valor << " es positivo " << endl;
system("pause");
return 0;

}


Dialogo
Código:

#include <iostream>
#include<string>

using namespace std;


int main()
{
cout << "DIALOGO";
cout << "\n";
cout << "como te llamas:\t";
string x;
cin >> x;
cout << "\n";
cout << " Que edad tienes " << x << ":\t";
int y;
cin >> y;
cout << "\n";
cout << "Quien descubrio America " << x << ":\t";
int z;
cin >> z;
cout << "\n";
cout << "Ontas  " << x << ":\t";
int w;
cin >> w;
cout << "\n";
system("pause");
return 0;



}


Funciones Constantes
Código:

#include <iostream>
#include <conio.h>

using namespace std;
void f(int a = 10, int b = 20, int c = 30)


{
cout << "a=" << a << endl;
cout << "b=" << b << endl;
cout << "c=" << c << endl;
}
void main (void)
{
f();
f(1);
f(1, 5);
f(1, 2, 3);
cout << "Pulse ENTER para continuar....";
system("pause");




}


Holas Infinitos
Código:

#include <iostream>

using namespace std;

int main()
{
int contador = 0;
int max;

cout << "cuantos Holas quieres?:\t";
cin >> max;
for (;;)
{
if (contador < max)
{
cout << "Hola!....\n";
contador++;
}
else
break;
}
return 0;

    
}


IVA de un Producto
Código:

#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
double a, b, c, i, t;
string p;
cout << "Ingrese el producto: ";
cin >> p;
cout << "Ingrese cantidad de Producto: ";
cin >> a;
cout << "Ingrese el precio: ";
cin >> b;
c = a * b;
cout << " la valor es:" << c << endl;
i = b * 14 / 100;
cout << " El iva  es:" << i << endl;
t = c + i;
cout << "El total a pagar es de :" << t << endl;
return 0;
}

Operaciones Básicas
Código:

#include <iostream>
#include<stdlib.h>
#include<math.h>

using namespace std;

int main()
{
float A, B, S, R1, R2, D1, D2, M;

    cout << "Escriba primer numero:\n";
cin >> A;
cout << "Escriba segundo numero\n";
cin >> B;
S= A + B;
R1= A - B;
R2= B - A;
D1= A / B;
D2= B / A;
M= (A * B);

cout << "la suma es:\t" << S << endl;
cout << "\n" << endl;
cout << "La resta de:\t" << A << "-" << B << " = " << R1 << endl;
cout << "\n" << endl;
cout << "la resta de:\t" << B << "-" << A << " = " << R2 << endl;
cout << "\n" << endl;
cout << "La division de:\t" << A << "/" << B << " = " << D1 << endl;
cout << "\n" << endl;
cout << "La division de:\t" << B << "/" << A << " = " << D2 << endl;
cout << "\n" << endl;
cout << "la multiplicacion es:\t" << M << endl;
cout << "\n" << endl;

system("pause");
return 0;


  
    


}


Promedio
Código:

#include <iostream>



using namespace std;
double media(double x1, double x2)


{
return (x1 + x2) / 2;
}
void main()
{
double N1, N2, M;
cout << "Dame 2 valores:\t";
cin >> N1 >> N2;
M = media(N1, N2);
cout << "Media = " << M << endl;
}


Suma de Datos
Código:

#include <iostream>

using namespace std;
const int num = 8;

int main()
 
{
int nums[num];
int total = 0;
for (int i = 0; i < num; i++)
{
cout << "por favor, Introduzca el numero";
cin >> nums[i];
total += nums[i];
}
cout << "el total de numero es" << total << endl;
system("pause");


    
}

Valor Menor
Código:

#include <iostream>

using namespace std;

int const LONG = 16;

int main()
{
int lista[LONG] = { 5, 2, 4, 9, 14, 4, 3, 2, 85, 11, 45, 25, 12, 45, 6, 99 };
int valor_menor, i;
valor_menor = lista[0];
for (i = 0; i < LONG; i++)
{
if (lista[i] < valor_menor)
{
valor_menor = lista[i];
}
cout << "El numero menor de la lista es";
cout << valor_menor << "\n";
system("pause");

}


Volumen del Cono
Código:

#include <iostream>
using namespace std;

const float PI = 3.1416;
inline float vcono(float radio, float altura)
{
return((PI * (radio * radio) * altura) / 3.0);
}
int main()
{
float radio, altura, V;
cout << "radio del cono= \t";
cin >> radio;
cout << "altura del cono= \t";
cin >> altura;
V = vcono(radio, altura);
cout << "El volumen del cono es= \t" << V;
return 0;
}


Área de Triangulo


Área de Círculo




martes, 25 de junio de 2019

Ejercicios Segunda Parte

ÁREA CUADRADO
Module Ejercicio4

    Sub Main()

        Console.WriteLine("Escribe el valor de un radio")
        Dim radio As Double = Console.ReadLine()

        Dim area As Double = Math.PI * Math.Pow(radio, 2)

        Console.WriteLine("El area es " & area)

        Console.ReadLine()

    End Sub

End Module

BUCLE

Module Ejercicio7

    Sub Main()

        For i As Integer = 0 To 100

            If i Mod 2 <> 0 Then
                Console.WriteLine(i)
            End If

        Next

        Console.ReadLine()

    End Sub

End Module


CALCULO DEL IVA

Module Ejercicio2

    Sub Main()

        Const IVA As Double = 0.21

        Console.WriteLine("Escribe el valor de un producto")
        Dim producto As Double = Console.ReadLine

        Console.WriteLine("El IVA del producto es " & producto * IVA & " euros. El valor final es " & producto + (producto * IVA) & " euros")

        Console.ReadLine()

    End Sub

End Module



CREAR NÚMERO ALEATORIO

Module Module1

    Sub Main()

        Dim numeroAleatorio As Integer = numAleatorioEntre(1, 10)

        Console.WriteLine("El numero generado es: " & numeroAleatorio)


        Console.ReadLine()

    End Sub

    Function numAleatorioEntre(ByVal minimo As Integer, ByVal maximo As Integer) As Integer
        Randomize()
        Return CLng((minimo - maximo) * Rnd() + maximo)
    End Function

End Module


GENERA 10 NÚMEROS ALEATORIOS

Module Module1

    Sub Main()

        Dim numeroAleatorio As Integer

        For i = 1 To 10

            numeroAleatorio = numAleatorioEntre(1, 10)

            Console.WriteLine("El numero generado es: " & numeroAleatorio)

        Next



        Console.ReadLine()

    End Sub

    Function numAleatorioEntre(ByVal minimo As Integer, ByVal maximo As Integer) As Integer
        Randomize()
        Return CLng((minimo - maximo) * Rnd() + maximo)
    End Function

End Module



MUESTRA NÚMEROS DEL 0 AL 100

Module Ejercicio6

    Sub Main()

        Dim i As Integer = 0

        While i <= 100

            If i Mod 2 <> 0 Then
                Console.WriteLine(i)
            End If

            i = i + 1

        End While

        Console.ReadLine()

    End Sub

End Module



PIDE 2 NÚMEROS POR TECLADO

Module Ejercicio5

    Sub Main()

        Console.WriteLine("Escribe el valor del primer numero")
        Dim num1 As Integer = Console.ReadLine()

        Console.WriteLine("Escribe el valor del segundo numero")
        Dim num2 As Integer = Console.ReadLine()

        If num1 Mod num2 = 0 Then
            Console.WriteLine("El número " & num1 & " es divisible por " & num2)
        Else
            Console.WriteLine("El número " & num1 & " no es divisible por " & num2)
        End If

        Console.ReadLine()

    End Sub

End Module


PIDE NÚMERO ENTRE 0 Y 10

Module Ejercicio8

    Sub Main()

        Dim num As Integer

        Do
            Console.WriteLine("Escribe un numero entre 0 y 10")
            num = Console.ReadLine

        Loop While num <= 0 Or num >= 10

        Console.WriteLine("El número introducido es " & num)

        Console.ReadLine()

    End Sub

End Module


SALUDO

Module Ejercicio1

    Sub Main()

        Console.WriteLine("Escribe un nombre")
        Dim nombre As String = Console.ReadLine

        Console.WriteLine("¡Hola " & nombre & "!")

        Console.ReadLine()

    End Sub

End Module


TABLA DE MULTIPLICAR

Module Ejercicio3

    Sub Main()

        Console.WriteLine("Escribe un numero")
        Dim numero As Integer = Console.ReadLine

        For i As Integer = 1 To 10

            Console.WriteLine(numero & " x " & i & " = " & numero * i)

        Next

        Console.ReadLine()

    End Sub

End Module



lunes, 24 de junio de 2019

Ejercicios Primera Parte

 HOLA MUNDO
Código:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        MsgBox("HolaMundo")

    End Sub
End Class




SUMA DE 2 NÚMEROS

Código:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim A, B, SUMA As Double
        A = TextBox1.Text
        B = TextBox2.Text
        SUMA = A + B
        TextBox3.Text = Trim(SUMA)

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""

    End Sub

End Class

CALCULADORA

Código:

Public Class Form1
    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
    End Sub

End Class



PROMEDIO

Código:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim A, B, C, D, Promedio As Double
        A = TextBox1.Text
        B = TextBox2.Text
        C = TextBox3.Text
        D = TextBox5.Text
        Promedio = (A + B + C + D) / 4
        TextBox4.Text = Trim(Promedio)

    End Sub

End Class


CUESTIONARIO

Código:

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim puntaje
        puntaje = 0
        If RadioButton1.Checked = True Then puntaje = puntaje + 2
        If RadioButton6.Checked = True Then puntaje = puntaje + 2
        If RadioButton9.Checked = True Then puntaje = puntaje + 2
        If RadioButton12.Checked = True Then puntaje = puntaje + 2
        If RadioButton13.Checked = True Then puntaje = puntaje + 2
        MsgBox("Su puntaje es:" + Str(puntaje) + "sobre 10")
    End Sub

End Class


CONVERTIDOR TEMPERATURA

Código:

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim A, SUMA As Double
        A = TextBox1.Text
        SUMA = (A * 1.8 + 32)
        TextBox2.Text = Trim(SUMA)
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim A, SUMA As Double
        A = TextBox1.Text
        SUMA = ((A - 32) / 1.8)
        TextBox2.Text = Trim(SUMA)
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim A, SUMA As Double
        A = TextBox1.Text
        SUMA = (A + 273.15)
        TextBox2.Text = Trim(SUMA)
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Dim A, SUMA As Double
        A = TextBox1.Text
        SUMA = (A - 273.15)
        TextBox2.Text = Trim(SUMA)
    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        TextBox1.Text = ""
        TextBox2.Text = ""

    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        Application.Exit()
    End Sub

End Class

ÁREA DEL CÍRCULO

Código:

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim radio, resultado As Integer
        radio = Val(TextBox1.Text)

        If radio = 0 Then
            MsgBox("Teclee informacion mayor a 0 ")
            Exit Sub
        End If
        resultado = 3.1416 * (radio * radio)
        TextBox2.Text = Trim(resultado)


    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
    End Sub

End Class


ÁREA DEL TRIÁNGULO

Código:

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim base, altura, resultado As Integer
        base = Val(TextBox1.Text)
        altura = Val(TextBox2.Text)

        If base = 0 Or altura = 0 Then
            MsgBox("Teclee informacion mayor a 0")
            Exit Sub
        End If
        resultado = base * altura / 2
        TextBox3.Text = Trim(resultado)


    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""

    End Sub

End Class



FORMULARIO

Código:

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Form2.TextBox1.Text = Me.TextBox1.Text
        Form2.TextBox2.Text = Me.TextBox2.Text
        Form2.TextBox3.Text = Me.TextBox3.Text
        Form2.TextBox4.Text = Me.TextBox4.Text
        



    End Sub

    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
        Form2.Show()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
    End Sub

End Class




FACTORIAL

Código:

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim num, i, factorial As Integer
        num = (Int(TextBox1.Text))
        factorial = 1
        For i = 1 To num
            factorial = factorial * i
        Next
        TextBox2.Text = factorial

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
    End Sub

End Class


Ejercicios Link Unidad No.3 Lenguaje Ensamblador

https://mega.nz/#F!30lAhSCB !eJSPm_L1GaETO7qZ1FmiQg *Cambia todas las letras a minúsculas *CBW Y CWD *Definición del Segmento de datos ...