Post Reply 
[HP Prime]Program to count bits - word - binary [New app]
09-23-2022, 05:50 AM (This post was last modified: 09-23-2022 03:21 PM by DrEureka.)
Post: #1
[HP Prime]Program to count bits - word - binary [New app]
Hello I leave this program I hope you will use whoever wants to use it, I am new in the PPL programming, apologize if there are better ways to improve the code.
[Image: ingreso-programa.HaAfY]
https://tinypic.host/i/ingreso-programa.HaAfY
Code:

//DrEureka Wbinary Ver. 0.0.1


EXPORT WBINARIO()
BEGIN
LOCAL Wo;
LOCAL Ra;
LOCAL Rb;
PRINT();
INPUT({
{Wo,[0],{50,30,1}} 
},
"WORD BINARIO", 
{"CANTIDAD N°:"}, 
{"Ingresar simbolo y magnitud"});
//Input por orden!
//variable + tipo de ingreso 0 es real + ancho del input nombre y ancho del ingreso + posicion puede ser de 0 a 6 para la primera pantalla y sucesivo.
//titulo de la app
//etiqueta del input
//ayuda en el casillero del input
IF Wo==0 THEN
        MSGBOX("ERROR:error de sintaxis. El valor no puede ser 0");
        KILL;
    END;

Ra:=(2^(Wo-1))-1;
Rb:=(2^(Wo-1));
PRINT("****RESULTADO****");
PRINT("");
PRINT("Valor ingresado: "+Wo);
PRINT("Cuenta para max positivos: (2^("+Wo+"-1))-1");
PRINT("Cuenta para max negativos: (2^("+Wo+"-1))");
PRINT("");
PRINT("POSITIVO MAX=+"+Ra);
PRINT("NEGATIVO MAX=-"+Rb);
WAIT(-1);
MSGBOX("Programa finalizado");
END;
Find all posts by this user
Quote this message in a reply
09-23-2022, 12:38 PM
Post: #2
RE: Program to count bits - word - binary
I’ve tried your program but found that LGVarNum is not defined which creates a syntax error.
Also can you provide some usage examples with input values and expected output results?
Find all posts by this user
Quote this message in a reply
09-23-2022, 03:06 PM
Post: #3
RE: Program to count bits - word - binary
(09-23-2022 12:38 PM)Didier Lachieze Wrote:  I’ve tried your program but found that LGVarNum is not defined which creates a syntax error.
Also can you provide some usage examples with input values and expected output results?

Hello, it has already been solved, as an example:

if the first binary sign is 0 it is positive if it is 1 it is negative, and it gives you the maximum that covers the number of bits according to the input, for example if there are 4 digits you can set between +15 and -16.
Thank you for your review, it helps me to continue improving.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)