Login
...or Sign up
Home
Search
Search Code Snippets
Search People
Code Snippets of
josino
//Lectura de un texto por teclado //y presentacion del texto por pantallla import java.io.*; public class interfaz_teclado_pantalla { public static void main(String [] args) { //leer por teclado un string try{ InputStreamReader leer = new InputStreamReader(System.in); BufferedReader buff = new BufferedReader(leer); System.out.print("Escriba el texto: "); String texto = buff.readLine(); //salida por pantalla del texto introducido System.out.println(texto); } //leer del teclado como String catch(java.io.IOException ioex) {} } }
Interfaz_teclado_pantalla
Uploaded on
4/9/2009 3:23:45 PM
0 comments
Programming Language:
java
lectura desde teclado;
#include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdlib.h> int main() { int pid1 = 0,pid2 = 0,pid3 = 0, pid_hijo1 = 0, pid_hijo2 = 0 ,status = 0; printf("Hola "); fflush(stdout); if ((pid1 = fork()) == -1) { printf("Error al crear proceso hijo\n"); exit(1); } if (pid1 == 0) {/* Proceso Hijo */ printf("tenga "); exit(1); } else {/* Proceso Padre */ if ((pid2 = fork()) == -1) { printf("Error al crear proceso hijo.\n"); exit(1); } if (pid2 == 0) {/* Proceso Hijo */ printf("dias "); exit(1); } else { /* Proceso Padre */ printf("Buenos "); fflush(stdout); if ((pid3 = fork()) == -1) { printf("Error al crear proceso hijo\n"); exit(1); } if (pid3 == 0) {/* Proceso Hijo */ printf("y "); printf("malos "); exit(1); } else { /* Proceso Padre*/ pid_hijo1=wait(&status); pid_hijo2=wait(&status); if ((pid_hijo1 == pid3) || (pid_hijo2 == pid3)) { wait(&status); } printf("usted. "); printf("Hasta "); printf("luego "); if ((pid_hijo1!=pid3)||(pid_hijo2!=pid3)) { wait(&status); } printf("Lucas\n"); } } } return(0); }
Implementación de un grafo de precedencia
Uploaded on
2/26/2009 2:34:09 AM
0 comments
Programming Language:
C
implementación grafo precedencia
sincronización procesos concurrentes
sistemas operativos
class Complejo { public double real; public double imag; public Complejo(double re ,double im) { this.real=re; this.imag=im; } public Complejo Add(Complejo z) { return new Complejo(this.real + z.real , this.imag + z.imag); } } class hilo extends Thread { public hilo(Complejo n1,Complejo n2) { } public void run() { Complejo a = new Complejo(40,56); Complejo b = new Complejo(10,-10); Complejo c = a.Add(b); System.out.println("Parte real: " + c.real); System.out.println("Parte imaginaria: " + c.imag); } }
Hilo sumador
Uploaded on
8/6/2008 12:09:19 PM
0 comments
Programming Language:
java
hilo de ejecución
suma complejos
import java.net.*; public class DireccionesIP { public static void main(String[] args) { byte[] b; try{ //Si se pasa un argumento obtenemos la direccion IP if (args.length > 0){ String host_remoto = args[0]; InetAddress address = InetAddress.getByName(host_remoto); String IP_remota = address.getHostAddress(); System.out.println("Direccion IP de la maquina remota : " + IP_remota); } //Si no obtenemos la direccion IP de la maquina local else{ InetAddress direccion = InetAddress.getLocalHost(); String nombreDelHost = direccion.getHostName();//nombre host String IP_local = direccion.getHostAddress();//ip como String System.out.println("La IP de la maquina local es : " + IP_local); System.out.println("El nombre del host local es : " + nombreDelHost); } } catch(Exception e) { e.printStackTrace(); } } }
Obtención de la dirección IP de un host de la red local
Uploaded on
8/6/2008 12:00:25 PM
1 comment
Programming Language:
java
dirección IP
datobin xdata 30h uni_dec xdata 31h tcoche data 30h coches_hechos data 20h coches_teoricos data 21h panelt equ p0 panelh equ p2 org 0h jmp inicio org 03h jmp menu org 0bh jmp contarhechos org 013h jmp tiempo org 01bh jmp calcular_deberia org 100h inicio: mov ie,#8fh mov tmod,#17h mov tcon,#1h mov th0,#-1 mov tl0,#-1 call inic_v setb tr0 jmp $ bin2bcd: push acc mov dptr,#30h movx a,@dptr mov b,#10 div ab swap a add a,b mov dptr,#31h movx @dptr,a pop acc ret inic_v: mov coches_hechos,#00h mov coches_teoricos,#00h mov tcoche,#1 ret contarhechos: clr tr0 inc coches_hechos mov a,coches_hechos mov dptr,#30h movx @dptr,a call bin2bcd mov dptr,#31h movx a,@dptr mov a,panelh reti menu: call inic_v mov ip,#04h mov ie,#8eh jb p3.2,$ jnb p3.2,$ mov ie,#8fh mov ip,#0h mov r2,#tcoche mov r1,#60 mov r0,#100 mov th1,#high(-10000) mov tl1,#low(-10000) setb tr1 reti tiempo: mov r5,tcoche cjne r5,#10,sal mov r5,#1 jmp sal sal: inc r5 mov tcoche,r5 reti calcular_deberia: clr tr1 djnz r0,sal1 mov r0,#100 mov th1,#high(-10000) mov tl1,#low(-10000) djnz r1,sal1 mov r1,#60 mov r0,#100 mov th1,#high(-10000) mov tl1,#low(-10000) mov r4,tcoche djnz r4,sal1 inc coches_teoricos mov a,coches_teoricos mov dptr,#30h movx @dptr,a call bin2bcd mov dptr,#31h movx a,@dptr mov a,panelt mov r4,tcoche mov r1,#60 mov r0,#100 mov th1,#high(-10000) mov tl1,#low(-10000) sal1: setb tr1 reti end
Cálculo y visualización del número de coches que se fabrican en una empresa automovilística
Uploaded on
7/26/2008 11:07:57 AM
0 comments
Programming Language:
microcontrolador 8051
contador de coches producidos
practica 5 sdp1 telecomunicaciones uvigo
1
2
3
4
...
Help
Help by email
What is Naslu?
|
About Naslu
|
Contact
|
Terms of Use
|
Downloads
|
Webprogramacion.com
|
Blog
|
Top
Links
Select language:
Español
|
English
© 2009 naslu.com