/*Paquete java.io
Tres personas deciden invertir su dinero para fundar una empresa. Cada una de ellas invierte una cantidad distinta. Obtener el porcentaje que cada quien invierte con respecto a la cantidad total invertida.*/
import java.io.*;
class Inversion
{
public static void main(String[] args)throws IOException
{
float inv1,inv2,inv3,i1,i2,i3,suma;
BufferedReader t= new BufferedReader (new InputStreamReader(System.in));
System.out.println("Ingresa la inversion de la persona #1");
inv1=Float.parseFloat(t.readLine());
System.out.println("Ingresa la inversion de la persona #2");
inv2=Float.parseFloat(t.readLine());
System.out.println("Ingresa la inversion de la persona #3");
inv3=Float.parseFloat(t.readLine());
suma=inv1+inv2+inv3;
i1=(float)((inv1*100)/suma);
i2=(float)((inv2*100)/suma);
i3=(float)((inv3*100)/suma);
System.out.printf("El porcentaje de la persona 1 es %.2f \n",i1);
System.out.printf("El porcentaje de la persona 2 es %.2f \n",i2);
System.out.printf("El porcentaje de la persona 3 es %.2f \n",i3);
}
}
miércoles, 23 de diciembre de 2015
Programación Java (secuencial) Pulsaciones
/*paquete java.io
Calcular el número de pulsaciones que una persona debe tener por cada 10 segundos de ejercicio, si la formula es: num. pulsaciones = (220 - edad)/10*/
import java.io.*;
class Pulsaciones
{
public static void main (String[] args) throws IOException
{
int edad,puls;
BufferedReader t= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa tu edad");
edad=Integer.parseInt(t.readLine());
puls=(220-edad)/10;
System.out.println("Tu numero de pulsaciones cada 10 segundos es de "+puls);
}
}
Calcular el número de pulsaciones que una persona debe tener por cada 10 segundos de ejercicio, si la formula es: num. pulsaciones = (220 - edad)/10*/
import java.io.*;
class Pulsaciones
{
public static void main (String[] args) throws IOException
{
int edad,puls;
BufferedReader t= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa tu edad");
edad=Integer.parseInt(t.readLine());
puls=(220-edad)/10;
System.out.println("Tu numero de pulsaciones cada 10 segundos es de "+puls);
}
}
Programación Java (secuencial) Valor absoluto
/*paquerte java.io
Leer un número y escribir el valor absoluto del mismo.*/
import java.io.*;
class ValorAbsoluto
{
public static void main(String[] args) throws IOException
{
float num,va;
BufferedReader t= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa un numero");
num=Float.parseFloat(t.readLine());
va=Math.abs(num);
System.out.printf("El valor absoluto de %.1f = %.1f\n",num,va);
}
}
Leer un número y escribir el valor absoluto del mismo.*/
import java.io.*;
class ValorAbsoluto
{
public static void main(String[] args) throws IOException
{
float num,va;
BufferedReader t= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa un numero");
num=Float.parseFloat(t.readLine());
va=Math.abs(num);
System.out.printf("El valor absoluto de %.1f = %.1f\n",num,va);
}
}
Programación Java (secuencial) Pesos a dolares
//paquete java.io
/* Dada una cantidad en pesos, obtener la equivalencia en dólares, asumiendo que la unidad cambiaría es un dato desconocido.*/
import java.io.*;
class PesosDolares
{
public static void main(String [] args) throws IOException
{
float ps,unidadc,dls;
BufferedReader t= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa unidad de cambio");
unidadc=Float.parseFloat(t.readLine());
System.out.println("Ingresa los pesos");
ps=Float.parseFloat(t.readLine());
dls=(float)ps/unidadc;
System.out.printf("%.2f pesos = %.2f dolares\n",ps,dls);
}
}
/* Dada una cantidad en pesos, obtener la equivalencia en dólares, asumiendo que la unidad cambiaría es un dato desconocido.*/
import java.io.*;
class PesosDolares
{
public static void main(String [] args) throws IOException
{
float ps,unidadc,dls;
BufferedReader t= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa unidad de cambio");
unidadc=Float.parseFloat(t.readLine());
System.out.println("Ingresa los pesos");
ps=Float.parseFloat(t.readLine());
dls=(float)ps/unidadc;
System.out.printf("%.2f pesos = %.2f dolares\n",ps,dls);
}
}
Programación Java (secuencial): suma de dos numeros
//paquete JAVAX.SWING
class SumaDosNumeros
{
public static void main(String [] arg)
{
int num1,num2,resultado;
num1=Integer.parseInt(JOptionPane.showInputDialog("Ingresa el primer numero"));
num2=Integer.parseInt(JOptionPane.showInputDialog("Ingresa el segundo numero"));
resultado=num1+num2;
JOptionPane.showMessageDialog(null,num1+" + "+num2+" = "+resultado);
}
}
//paquete JAVA.IO
class SumaDosNumeros
{
public static void main(String [] arg)throws IOException
{
int num1,num2,resultado;
BufferedReader t=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa el primer numero");
num1=Integer.parseInt(t.readLine());
System.out.println("Ingresa el segundo numero");
num2=Integer.parseInt(t.readLine());
resultado=num1+num2;
System.out.println(num1+" + "+num2+" = "+resultado);
}
}
//paquete JAVA.UTIL
class SumaDosNumeros
{
public static void main(String [] arg)
{
float num1,num2,resultado;
Scanner t=new Scanner(System.in);
System.out.println("Ingresa el primer numero");
num1=t.nextFloat();
System.out.println("Ingresa el segundo numero");
num2=t.nextFloat();
resultado=num1+num2;
System.out.println(num1+" + "+num2+" = "+resultado);
}
}
viernes, 12 de junio de 2015
Programación Visual Basic Insertar Imagen
Programacion en VB Mostrar y Ocultar una Imagen
FORM:
NOMBRE: Form1
CAPTION: "Mostrar y Ocultar Imagen"
PICTUREBOX:
NOMBRE: imagen
PICTURE: (Seleccionar imagen desde la pc)
STRETCH: "true"
COMMANDBUTTON:
COMMANDBUTTON 1 NOMBRE: Command1
COMMANDBUTTON 1 CAPTION: "MOSTRAR"
COMMANDBUTTON 2 NOMBRE: Command2
COMMANDBUTTON 2 CAPTION: "OCULTAR"
CODIGO:
Private Sub Command1_Click()
imagen.Visible = True
End Sub
___________________________________________________
Private Sub Command2_Click()
imagen.Visible = False
End Sub
FORM:
NOMBRE: Form1
CAPTION: "Mostrar y Ocultar Imagen"
PICTUREBOX:
NOMBRE: imagen
PICTURE: (Seleccionar imagen desde la pc)
STRETCH: "true"
COMMANDBUTTON:
COMMANDBUTTON 1 NOMBRE: Command1
COMMANDBUTTON 1 CAPTION: "MOSTRAR"
COMMANDBUTTON 2 NOMBRE: Command2
COMMANDBUTTON 2 CAPTION: "OCULTAR"
CODIGO:
Private Sub Command1_Click()
imagen.Visible = True
End Sub
___________________________________________________
Private Sub Command2_Click()
imagen.Visible = False
End Sub
DESCARGA EL .EXE DEL PROGRAMA: CLICK AQUÍ
Programacion Visual Basic Calcular Areas
Programación en VB Calcular Áreas de un Cuadrado, un Rectángulo y un Triangulo
FORM:
NOMBRE: Form1
CAPTION: Calcular area
FRAME:
FRAME 1 NOMBRE: Frame1
FRAME 1 CAPTION: CUADRADO
FRAME 2 NOMBRE: Frame2
FRAME 2 CAPTION: RECTANGULO
FRAME 3 NOMBRE: Frame3
FRAME 3 CAPTION: TRIANGULO
LABEL 7 NOMBRE: RES
LABEL 7 CAPTION: (VACIO)
TEXTBOX:
TEXTBOX1 NOMBRE: cuadrado
TEXTBOX1 TEXT: (VACIO)
TEXTBOX2 NOMBRE: Text1
TEXTBOX2 TEXT: (VACIO)
TEXTBOX3 NOMBRE: Text2
TEXTBOX3 TEXT: (VACIO)
TEXTBOX4 NOMBRE: Text3
TEXTBOX4 TEXT: (VACIO)
TEXTBOX5 NOMBRE: Text4
TEXTBOX5 TEXT: (VACIO)
COMMANDBUTTON:
COMMANDBUTTON 1 NOMBRE: Command1
COMMANDBUTTON 1 CAPTION: "CALCULAR"
COMMANDBUTTON 2 NOMBRE: Command2
COMMANDBUTTON 2 CAPTION: "CALCULAR"
COMMANDBUTTON 3 NOMBRE: Command3
COMMANDBUTTON 3 CAPTION: "CALCULAR"
COMMANDBUTTON 4 NOMBRE: Command4
COMMANDBUTTON 4 CAPTION: "LIMPIAR"
COMMANDBUTTON 5 NOMBRE: Command5
COMMANDBUTTON 5 CAPTION: "SALIR"
CODIGO
Private Sub Command1_Click()
RES.Caption = Val(cuadrado.Text) * Val(cuadrado.Text)
End Sub
_________________________________________________________
Private Sub Command2_Click()
RES.Caption = Val(Text1.Text) * Val(Text2.Text)
End Sub
_________________________________________________________
Private Sub Command3_Click()
RES.Caption = (Val(Text3.Text) * Val(Text4.Text)) / 2
End Sub
_________________________________________________________
Private Sub Command4_Click()
cuadrado.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
_________________________________________________________
Private Sub Command5_Click()
End
End Sub
_________________________________________________________
Private Sub RES_Click()
End Sub
DESCARGA EL .EXE DEL PRPGRAMA: CLICK AQUÍ
FORM:
NOMBRE: Form1
CAPTION: Calcular area
FRAME:
FRAME 1 NOMBRE: Frame1
FRAME 1 CAPTION: CUADRADO
FRAME 2 NOMBRE: Frame2
FRAME 2 CAPTION: RECTANGULO
FRAME 3 NOMBRE: Frame3
FRAME 3 CAPTION: TRIANGULO
LABEL:
LABEL 1 NOMBRE: Label1
LABEL 1 CAPTION: "Valor de lado"
LABEL 2 NOMBRE: Label2
LABEL 2 CAPTION: "Valor de lado mayor"
LABEL 3 NOMBRE: Label3
LABEL 3 CAPTION: "Valor del lado menor"
LABEL 4 NOMBRE: Label4
LABEL 4 CAPTION: "Valor de la base"
LABEL 5 NOMBRE: Label5
LABEL 5 CAPTION: "Valor de la altura"
LABEL 6 NOMBRE: Label6
LABEL 6 CAPTION: "RESULTADO"
LABEL 1 NOMBRE: Label1
LABEL 1 CAPTION: "Valor de lado"
LABEL 2 NOMBRE: Label2
LABEL 2 CAPTION: "Valor de lado mayor"
LABEL 3 NOMBRE: Label3
LABEL 3 CAPTION: "Valor del lado menor"
LABEL 4 NOMBRE: Label4
LABEL 4 CAPTION: "Valor de la base"
LABEL 5 NOMBRE: Label5
LABEL 5 CAPTION: "Valor de la altura"
LABEL 6 NOMBRE: Label6
LABEL 6 CAPTION: "RESULTADO"
LABEL 7 NOMBRE: RES
LABEL 7 CAPTION: (VACIO)
TEXTBOX:
TEXTBOX1 NOMBRE: cuadrado
TEXTBOX1 TEXT: (VACIO)
TEXTBOX2 NOMBRE: Text1
TEXTBOX2 TEXT: (VACIO)
TEXTBOX3 NOMBRE: Text2
TEXTBOX3 TEXT: (VACIO)
TEXTBOX4 NOMBRE: Text3
TEXTBOX4 TEXT: (VACIO)
TEXTBOX5 NOMBRE: Text4
TEXTBOX5 TEXT: (VACIO)
COMMANDBUTTON:
COMMANDBUTTON 1 NOMBRE: Command1
COMMANDBUTTON 1 CAPTION: "CALCULAR"
COMMANDBUTTON 2 NOMBRE: Command2
COMMANDBUTTON 2 CAPTION: "CALCULAR"
COMMANDBUTTON 3 NOMBRE: Command3
COMMANDBUTTON 3 CAPTION: "CALCULAR"
COMMANDBUTTON 4 NOMBRE: Command4
COMMANDBUTTON 4 CAPTION: "LIMPIAR"
COMMANDBUTTON 5 NOMBRE: Command5
COMMANDBUTTON 5 CAPTION: "SALIR"
CODIGO
Private Sub Command1_Click()
RES.Caption = Val(cuadrado.Text) * Val(cuadrado.Text)
End Sub
_________________________________________________________
Private Sub Command2_Click()
RES.Caption = Val(Text1.Text) * Val(Text2.Text)
End Sub
_________________________________________________________
Private Sub Command3_Click()
RES.Caption = (Val(Text3.Text) * Val(Text4.Text)) / 2
End Sub
_________________________________________________________
Private Sub Command4_Click()
cuadrado.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
_________________________________________________________
Private Sub Command5_Click()
End
End Sub
_________________________________________________________
Private Sub RES_Click()
End Sub
DESCARGA EL .EXE DEL PRPGRAMA: CLICK AQUÍ
Programacion HTML Crear Tablas
Programacion en HTML Crear Tablas
CODIGO
<html>
<title>Tablas</title>
<marquee><head><h2>CREAR TABLAS EN HTML</h2></head></marquee>
<p><h2 align="center">Tabla de 4 X 4 </h2></p>
<table align="center">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con Diviciones</h2></p>
<table align="center" rules="all" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla sin Diviciones</h2></p>
<table align="center" rules="none" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con Borde 10 </h2></p>
<table align="center" border="10">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con frame en el borde</h2></p>
<table align="center" frame="border" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con frame sobre la tabla</h2></p>
<table align="center" frame="above" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con frame bajo la tabla</h2></p>
<table align="center" frame="below" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
</html>
RESULTADO:Tablas
CODIGO
<html>
<title>Tablas</title>
<marquee><head><h2>CREAR TABLAS EN HTML</h2></head></marquee>
<p><h2 align="center">Tabla de 4 X 4 </h2></p>
<table align="center">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con Diviciones</h2></p>
<table align="center" rules="all" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla sin Diviciones</h2></p>
<table align="center" rules="none" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con Borde 10 </h2></p>
<table align="center" border="10">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con frame en el borde</h2></p>
<table align="center" frame="border" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con frame sobre la tabla</h2></p>
<table align="center" frame="above" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
<br><br>
<p><h2 align="center">Tabla con frame bajo la tabla</h2></p>
<table align="center" frame="below" border="1">
<th>X</th><th>1</th> <th>2</th> <th>3</th>
<tr>
<th>1</th> <td>1</td><td>2</td><td>3</td>
<tr>
<th>2</th><td>2</td><td>4</td><td>6</td>
<tr>
<th>3</th><td>3</td><td>6</td><td>9</td>
</table>
</html>
RESULTADO:
Tabla de 4 X 4
| X | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 | 2 | 3 |
| 2 | 2 | 4 | 6 |
| 3 | 3 | 6 | 9 |
Tabla con Diviciones
| X | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 | 2 | 3 |
| 2 | 2 | 4 | 6 |
| 3 | 3 | 6 | 9 |
Tabla sin Diviciones
| X | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 | 2 | 3 |
| 2 | 2 | 4 | 6 |
| 3 | 3 | 6 | 9 |
Tabla con Borde 10
| X | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 | 2 | 3 |
| 2 | 2 | 4 | 6 |
| 3 | 3 | 6 | 9 |
Tabla con frame en el borde
| X | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 | 2 | 3 |
| 2 | 2 | 4 | 6 |
| 3 | 3 | 6 | 9 |
Tabla con frame sobre la tabla
| X | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 | 2 | 3 |
| 2 | 2 | 4 | 6 |
| 3 | 3 | 6 | 9 |
Tabla con frame bajo la tabla
| X | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1 | 2 | 3 |
| 2 | 2 | 4 | 6 |
| 3 | 3 | 6 | 9 |
Programacion HTML Estructura Basica
Programacion en HTML "Mi pagina web":
CODIGO
<html>
<title>Mi pagina web</title>
<head><h1 align="center"><marquee>BIENVENIDOS A MI PAGINA WEB</marquee></h1></head>
<body>
<p><h2>Hola a todos espero que les guste mi blog, cuaquier duda o aclaracion haganmela saber porfavor</h2></p>
<p><h2>Gracias por leer mi blog y si les ha sido de ayuda agradeceria que dejaras tu comentario</h2></p>
</body>
</html>
DONDE:
<html></html>: El inicio y el fin de la pagina web.
<title></title>: El inicio y final del titulo de la pestaña.
<head></head>: Etiquetas de la cabecera.
<hi align="center"></h1>: Etiquetas del tamaño de letra y la alineación del texto.
<h2></h2>: Etiquetas de tamaño de letra.
<p></p>: Inicio y fin de un párrafo.
RESULTADO:
Mi pagina web
CODIGO
<html>
<title>Mi pagina web</title>
<head><h1 align="center"><marquee>BIENVENIDOS A MI PAGINA WEB</marquee></h1></head>
<body>
<p><h2>Hola a todos espero que les guste mi blog, cuaquier duda o aclaracion haganmela saber porfavor</h2></p>
<p><h2>Gracias por leer mi blog y si les ha sido de ayuda agradeceria que dejaras tu comentario</h2></p>
</body>
</html>
DONDE:
<html></html>: El inicio y el fin de la pagina web.
<title></title>: El inicio y final del titulo de la pestaña.
<head></head>: Etiquetas de la cabecera.
<hi align="center"></h1>: Etiquetas del tamaño de letra y la alineación del texto.
<h2></h2>: Etiquetas de tamaño de letra.
<p></p>: Inicio y fin de un párrafo.
RESULTADO:
Hola a todos espero que les guste mi blog, cuaquier duda o aclaracion haganmela saber porfavor
Gracias por leer mi blog y si les ha sido de ayuda agradeceria que dejaras tu comentario
Programacion C++ Llenar una matriz
Programacion en c++ Llenar una matriz 3X3 e imprimirla en pantalla
Biblioteca <stdio.h>
#include <stdio.h>
int main()
{
int matriz[3][3];
int i,j;
puts("Llena la matriz \n");
for (i=0;i<=2;i++)
{
for (j=0;j<=2;j++)
{
printf("Introduce el valor de la coordenada (%d,%d) ", i,j);
scanf("%d",& matriz[i][j]);
}
}
for (i=0;i<=2;i++)
{
for (j=0;j<=2;j++)
{
printf("%d ",matriz[i][j]);
}
printf("\n");
}
return 0;
}
Biblioteca <iostream>
#include <iostream>
using namespace std;
int main()
{
int matriz[3][3];
int i,j;
cout<<"Llena la matriz"<<endl;
for (i=0;i<=2;i++)
{
for (j=0;j<=2;j++)
{
cout<<"Introduce el valor de la coordenada "<<"("<< i <<","<<j<<") ";
cin>>matriz[i][j];
}
}
for (i=0;i<=2;i++)
{
for (j=0;j<=2;j++)
{
cout<<" "<<matriz[i][j];
}
cout<<""<<endl;
}
return 0;
}
Programacion C++ Numeros Random
El programa básicamente genera 3 números aleatorios, compara dichos números y si todos son iguales "GANASTE" por el contrario si son diferentes "PIERDES"
Bibliotecas <stdio.h> <stdlib.h> <time.h>
#include <stdlib.h>
#include <time.h>
#include<stdio.h>
int main()
{
puts("Suerte, preciona cualquier tecla para jugar \n");
system("pause>null");
int num1,num2,num3;
srand(time(NULL));
num1=rand() % 2;
printf("%d ",num1);
num2=rand() % 2;
printf("%d ",num2);
num3=rand() % 2;
printf("%d \n\n",num3);
if(num1==num2 and num1==num3)
{
puts("GANASTE!!!");
}
else
{
puts("PERDISTE!!!");
}
return 0;
}
Bibliotecas <iostream> <stdlib.h> <time.h>
#include <stdlib.h>
#include <time.h>
#include<iostream>
using namespace std;
int main()
{
cout<<"Suerte, preciona cualquier tecla para jugar"<<endl;
system("pause>null");
int num1,num2,num3;
srand(time(NULL));
num1=rand() % 2;
cout<<num1<<" ";
num2=rand() % 2;
cout<<num2<<" ";
num3=rand() % 2;
cout<<num3<<" "<<endl;
if(num1==num2 and num1==num3)
{
cout<<"GANASTE!!!";
}
else
{
cout<<"Perdiste!!!";
}
return 0;
}
jueves, 11 de junio de 2015
Programacion Visual Basic Calculadora
Programacion en VB Calculadora basica
FORM:
NOMBRE: Form1
CAPTION: Calculadora
TEXTBOX:
TEXTBOX1 NOMBRE: n1
TEXTBOX1 TEXT: (VACIO)
TEXTBOX2 NOMBRE: n2
TEXTBOX2 TEXT: (VACIO)
LABEL:
LABEL 1 NOMBRE: opc
LABEL 1 CAPTION: (VACIO)
LABEL 2 NOMBRE: Label2
LABEL 2 CAPTION: "="
LABEL 3 NOMBRE: res
LABEL 3 CAPTION: (VACIO)
COMMANDBUTTON:
COMMANDBUTTON 1 NOMBRE: suma
COMMANDBUTTON 1 CAPTION: "+"
COMMANDBUTTON 2 NOMBRE: resta
COMMANDBUTTON 2 CAPTION: "-"
COMMANDBUTTON 3 NOMBRE: multi
COMMANDBUTTON 3 CAPTION: "*"
COMMANDBUTTON 4 NOMBRE: div
COMMANDBUTTON 4 CAPTION: "/"
COMMANDBUTTON 5 NOMBRE: Command1
COMMANDBUTTON 5 CAPTION: "Salir"
End
End Sub
__________________________________________________
Private Sub div_Click()
opc.Caption = "/"
res.Caption = Val(n1.Text) / Val(n2.Text)
End Sub
__________________________________________________
Private Sub multi_Click()
opc.Caption = "x"
res.Caption = Val(n1.Text) * Val(n2.Text)
End Sub
__________________________________________________
Private Sub resta_Click()
opc.Caption = "-"
res.Caption = Val(n1.Text) - Val(n2.Text)
End Sub
__________________________________________________
Private Sub suma_Click()
opc.Caption = "+"
res.Caption = Val(n1.Text) + Val(n2.Text)
End Sub
__________________________________________________
DESCARGA EL .EXE DEL PROGRAMA: Click aquí
FORM:
NOMBRE: Form1
CAPTION: Calculadora
TEXTBOX:
TEXTBOX1 NOMBRE: n1
TEXTBOX1 TEXT: (VACIO)
TEXTBOX2 NOMBRE: n2
TEXTBOX2 TEXT: (VACIO)
LABEL:
LABEL 1 NOMBRE: opc
LABEL 1 CAPTION: (VACIO)
LABEL 2 NOMBRE: Label2
LABEL 2 CAPTION: "="
LABEL 3 NOMBRE: res
LABEL 3 CAPTION: (VACIO)
COMMANDBUTTON:
COMMANDBUTTON 1 NOMBRE: suma
COMMANDBUTTON 1 CAPTION: "+"
COMMANDBUTTON 2 NOMBRE: resta
COMMANDBUTTON 2 CAPTION: "-"
COMMANDBUTTON 3 NOMBRE: multi
COMMANDBUTTON 3 CAPTION: "*"
COMMANDBUTTON 4 NOMBRE: div
COMMANDBUTTON 4 CAPTION: "/"
COMMANDBUTTON 5 NOMBRE: Command1
COMMANDBUTTON 5 CAPTION: "Salir"
CODIGO
Private Sub Command1_Click()End
End Sub
__________________________________________________
Private Sub div_Click()
opc.Caption = "/"
res.Caption = Val(n1.Text) / Val(n2.Text)
End Sub
__________________________________________________
Private Sub multi_Click()
opc.Caption = "x"
res.Caption = Val(n1.Text) * Val(n2.Text)
End Sub
__________________________________________________
Private Sub resta_Click()
opc.Caption = "-"
res.Caption = Val(n1.Text) - Val(n2.Text)
End Sub
__________________________________________________
Private Sub suma_Click()
opc.Caption = "+"
res.Caption = Val(n1.Text) + Val(n2.Text)
End Sub
__________________________________________________
DESCARGA EL .EXE DEL PROGRAMA: Click aquí
Programacion Visual Basic VScroll
Programacion en VB Termometro que convierte °C a °F
FORM:
-NOMBRE: °F°C
-CAPTION: °F°C
VScroll:
-NOMBRE: VScroll1
LABEL:
-LABEL 1 NOMBRE: Label1
-LABEL 1 CAPTION: CENTIGRADOS
-LABEL 2 NOMBRE: Label2
-LABEL 2 CAPTION: FAHRENHEID
-LABEL 3 NOMBRE: C
-LABEL 3 CAPTION:(VACIO)
-LABEL 4 NOMBRE: F
-LABEL 4 CAPTION(VACIO)
COMMANDBUTTON:
-COMMAND1 NOMBRE:Command1
-COMMAND1 CAPTION: SALIR
Private Sub CENT_Change()
End Sub
__________________________________________
Private Sub Command1_Click()
End
End Sub
__________________________________________
Private Sub VScroll1_Change()
C.Caption = VScroll1.Value
F.Caption = 32 + 1.8 * VScroll1.Value
End Sub
__________________________________________
DESCARGA EL .EXE DEL PROGRAMA: Click aquí
FORM:
-NOMBRE: °F°C
-CAPTION: °F°C
VScroll:
-NOMBRE: VScroll1
LABEL:
-LABEL 1 NOMBRE: Label1
-LABEL 1 CAPTION: CENTIGRADOS
-LABEL 2 NOMBRE: Label2
-LABEL 2 CAPTION: FAHRENHEID
-LABEL 3 NOMBRE: C
-LABEL 3 CAPTION:(VACIO)
-LABEL 4 NOMBRE: F
-LABEL 4 CAPTION(VACIO)
COMMANDBUTTON:
-COMMAND1 NOMBRE:Command1
-COMMAND1 CAPTION: SALIR
CODIGO
Private Sub CENT_Change()
End Sub
__________________________________________
Private Sub Command1_Click()
End
End Sub
__________________________________________
Private Sub VScroll1_Change()
C.Caption = VScroll1.Value
F.Caption = 32 + 1.8 * VScroll1.Value
End Sub
__________________________________________
DESCARGA EL .EXE DEL PROGRAMA: Click aquí
Programacion C++ String (Cadena)
Programacion en c++: Leer nombre y contar numero de letras. Uso de "strlen"
Biblioteca <stdio.h> & <string.h>
#include <stdio.h>
#include <string.h>
int main()
{
char nom[20];
int nl;
printf("Ingresa tu primer nombre \n");
scanf("%s",&nom);
printf("\nHola %s\n",nom);
nl=strlen(nom);
printf("Tu nombre tiene %d letras",nl);
return 0;
}
Biblioteca <iostream> & <string.h>
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char nom[20];
int nl;
cout<<"Ingresa tu primer nombre"<<endl;
cin>>nom;
cout<<endl<<"Hola "<<nom<<endl;
nl=strlen(nom);
cout<<"Tu nombre tiene "<<nl<< " letras"<<endl;
return 0;
}
Biblioteca <stdio.h> & <string.h>
#include <stdio.h>
#include <string.h>
int main()
{
char nom[20];
int nl;
printf("Ingresa tu primer nombre \n");
scanf("%s",&nom);
printf("\nHola %s\n",nom);
nl=strlen(nom);
printf("Tu nombre tiene %d letras",nl);
return 0;
}
Biblioteca <iostream> & <string.h>
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char nom[20];
int nl;
cout<<"Ingresa tu primer nombre"<<endl;
cin>>nom;
cout<<endl<<"Hola "<<nom<<endl;
nl=strlen(nom);
cout<<"Tu nombre tiene "<<nl<< " letras"<<endl;
return 0;
}
miércoles, 10 de junio de 2015
Programacion C++ Suma de marices
Programacion en c++ Suma de matrices.
Biblioteca <stdio.h>
#include <stdio.h>
int main()
{
int m1[3][3],m2[3][3],m3[3][3],i,j;
puts("Llena la primer matriz");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("Ingresa un valor en la cordenada (%d,%d) de la matriz 1\n",i,j);
scanf("%d",&m1[i][j]);
}
}
printf("\n");
puts("Llena la segunda matriz");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("Ingresa un valor en la cordenada (%d,%d) de la matriz 2 \n",i,j);
scanf("%d",&m2[i][j]);
}
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
m3[i][j]=(m1[i][j])+(m2[i][j]);
}
}
printf("\n");
puts("La suma es:");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf(" %d",m3[i][j]);
}
printf("\n");
}
return 0;
}
Biblioteca <iostream>
#include <iostream>
using namespace std;
int main()
{
int m1[3][3],m2[3][3],m3[3][3],i,j;
cout<<"Llena la primer matriz"<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<"Ingresa un valor en la cordenada "<<"("<<i<<","<<j<<")"<<endl;
cin>>m1[i][j];
}
}
cout<<endl;
cout<<"Llena la segunda matriz"<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<"Ingresa un valor en la cordenada "<<"("<<i<<","<<j<<")"<<endl;
cin>>m2[i][j];
}
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
m3[i][j]=(m1[i][j])+(m2[i][j]);
}
}
cout<<endl;
cout<<"La suma es:"<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<" "<<m3[i][j];
}
cout<<endl;
}
return 0;
}
Biblioteca <stdio.h>
#include <stdio.h>
int main()
{
int m1[3][3],m2[3][3],m3[3][3],i,j;
puts("Llena la primer matriz");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("Ingresa un valor en la cordenada (%d,%d) de la matriz 1\n",i,j);
scanf("%d",&m1[i][j]);
}
}
printf("\n");
puts("Llena la segunda matriz");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("Ingresa un valor en la cordenada (%d,%d) de la matriz 2 \n",i,j);
scanf("%d",&m2[i][j]);
}
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
m3[i][j]=(m1[i][j])+(m2[i][j]);
}
}
printf("\n");
puts("La suma es:");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf(" %d",m3[i][j]);
}
printf("\n");
}
return 0;
}
Biblioteca <iostream>
#include <iostream>
using namespace std;
int main()
{
int m1[3][3],m2[3][3],m3[3][3],i,j;
cout<<"Llena la primer matriz"<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<"Ingresa un valor en la cordenada "<<"("<<i<<","<<j<<")"<<endl;
cin>>m1[i][j];
}
}
cout<<endl;
cout<<"Llena la segunda matriz"<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<"Ingresa un valor en la cordenada "<<"("<<i<<","<<j<<")"<<endl;
cin>>m2[i][j];
}
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
m3[i][j]=(m1[i][j])+(m2[i][j]);
}
}
cout<<endl;
cout<<"La suma es:"<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<" "<<m3[i][j];
}
cout<<endl;
}
return 0;
}
Suscribirse a:
Comentarios (Atom)























