hacker


Ingresar con nombre de usuario, contraseña y duración de la sesión
| Portal Hacker | Editorial | Descargas | Ezine |
Inicio Ayuda Ingresar Registrarse
25 de Julio de 2008, 02:21:27
Noticias: Convocatoria E-zine CPH #2
Para ver este enlace Registrate o Inicia Sesion
Aquí

+  Foros pOrtal Hacker
|-+  Programacion
| |-+  Programación en general
| | |-+  Visual Basic (Moderadores: ranefi, crypto136, ziBboh, >> s E t H <<)
| | | |-+  CALCULADORA.VBS
0 Usuarios y 1 Visitante están viendo este tema. « anterior próximo »
Páginas: [1] Ir Abajo Imprimir
Autor Tema: CALCULADORA.VBS  (Leído 1241 veces)
zickox
NZ1
*
Desconectado Desconectado

Mensajes: 67



Ver Perfil
« : 31 de Julio de 2006, 12:34:00 »

hola bueno e creado una calculadora en visual basic script hace tiempo como e podido, creo que es lo mejor que se puede hacer a menos que no conosca alguna funcion, propiedad u objeto ke me pudiera favorecer ya ke no hay mucha info pero bueno aka la dejo
Código:
'                   ###########################
'                    ##                                                 ##
'                    ##                                                 ##
'                    ##         BY  ZICKOX                  ##
'                    ##                                                ##
'                    ##                                                ##
'                    ##########################
zki = msgbox ("hola quieres acceder a la ayuda", vbokcancel, "mensaje")
if zki = 1 then
msgbox "si quieres sacar la raiz escribe raiz"
msgbox "si quieres aproximar una sifra escribe aproximar"
msgbox "si quieres sumar escribe suma"
msgbox "si quieres restar escribe resta"
msgbox "si quieres multiplicar escribe multiplicar"
msgbox "si quieres dividir escribe dividir"
msgbox "eso es todo salu2 =) by zickox"
end if
FUNCTION sumar (sumando_1, sumando_2)
        sumar = (CLNG(sumando_1) + CLNG(sumando_2))
    end function

var = inputbox ("escribe la operacion a realizar","calculadora","suma")

if var = "suma" then
sum1 = inputbox ("escribe primer digito","sumando")
sum2 = inputbox ("escribe segundo digito","sumando")
resultado =  sumar (sum1, sum2)
  MSGBOX ("El resultado es " & resultado)
end if
if var = "resta" then
resta = inputbox ("escribe primer digito","restando")
resta1 = inputbox ("escribe segundo digito","restando")
resta2  = resta - resta1
msgbox resta2
end if
if var = "multiplicacion" then
mult = inputbox ("escribe primer digito","multiplicando")
mult1 = inputbox ("escribe segundo digito","multiplicando")
mult2  = mult * mult1
msgbox mult2
end if
if var = "divicion" then
divicion =inputbox ("escribe primer digito","dividiendo")
divicion1 = inputbox ("escribe segundo digito","dividiendo")
divicion2  = divicion  / divicion1
msgbox divicion2
end if

if var = "raiz" then
raiz = inputbox ("escribe la sifra","sacando raiz")
raiz1 = Sqr(raiz)
msgbox raiz1
end if
if var = "aproximar" then
aprox  = inputbox ("introduce la sifra ke kieres aproximar","aproximando")
aprox1 = round (aprox)
msgbox aprox1
end if


salu2
En línea

google todo lo sabe
Hait-ScriptXpert
NZ1
*
Desconectado Desconectado

Mensajes: 61


Ver Perfil WWW
« Respuesta #1 : 19 de Marzo de 2007, 09:13:02 »

es mejor en html, mira este:
<html>
<head>
<title>Calculadora</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language=vbscript>
Sub suma()
  formulario.res .value=formulario.op1.Value  + formulario.op2 .Value
 End sub

 Sub resta()
 formulario.res .value=formulario.op1.Value - formulario.op2 .Value
  End sub

 Sub mult()
 formulario.res .value=formulario.op1.Value * formulario.op2 .Value
 End sub

Sub div()
formulario.res .value=formulario.op1.Value / formulario.op2 .Value
 End sub
 </script>
</head>

<body bgcolor="#FFFFFF">
<form  name="formulario">
  Operando1:
    <input type="Text" name="op1" size="10" maxlength="10">
   

    Operando2:
    <input type="Text" name="op2" size="10" maxlength="10">
   

    Resultado:
    <input type="Text" name="res" size="10" maxlength="10">
   

    <input type="Button" value="sumar" onClick="suma" >
    <input type="Button" value="restar" onClick="resta" >
    <input type="Button" value="multiplicar" onClick="mult" >
    <input type="Button" value="dividir" onClick="div" >

</form>
</body>
</html>
Lo escribes en el bloc de notas, y lo guardas como calculadora.ht m.

En línea


Para ver este enlace Registrate o Inicia Sesion
Hait-ScriptXpert
NZ1
*
Desconectado Desconectado

Mensajes: 61


Ver Perfil WWW
« Respuesta #2 : 28 de Marzo de 2007, 09:25:56 »

Mejoré tal script vbs...
look:

Código:
FUNCTION sumar (sumando_1, sumando_2)
        sumar = (CLNG(sumando_1) + CLNG(sumando_2))
    end function

var = inputbox ("Primer operando","Calculadora")
var3 = inputbox ("Operación: +, -, *, /, ¬, >..." & Chr(10) & Chr(13) & "+= suma" & Chr(10) & Chr(13) & "-= resta" & Chr(10) & Chr(13) & "*= multiplicacion" & Chr(10) & Chr(13) & "/= division" & Chr(10) & Chr(13) & "¬= raiz cuadrada" & Chr(10) & Chr(13) & ">= aproximar","Calculadora")
var2 = inputbox ("Segundo operando (Si es raiz cuadrada ¬ o aproximación > lo que sacarás, cancela este campo)","Calculadora")

if var3 = "+" then
resultado =  sumar (var, var2)
  MSGBOX resultado
end if
if var3 = "-" then
resta2  = var - var2
msgbox resta2
end if
if var3 = "*" then
mult2  = var * var2
msgbox mult2
end if
if var3 = "/" then
divicion2  = var  / var2
msgbox divicion2
end if

if var3 = "¬" then
raiz1 = Sqr(var)
msgbox raiz1
end if
if var = ">" then
aprox1 = round (aprox)
msgbox aprox1
end if

bueno tu code zickox...
En línea


Para ver este enlace Registrate o Inicia Sesion
Páginas: [1] Ir Arriba Imprimir 
« anterior próximo »
Ir a:  


Ingresar con nombre de usuario, contraseña y duración de la sesión

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC hacker

Juegos gratis - Articulos PHP - Juegos - Trucos - Letras - Juegos - Juegos Online