HP Forums

Full Version: Problems with my first program [solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!
I'm writing my first program, and I'm having a little problem with the following code:

Code:
EXPORT tiro1()
BEGIN
local M,str,xpos0,ypos0;
local lista1, lista2;
local angulo;

CHOOSE(M, "Unidades", "SI", "US");
IF M==1 THEN
  str := "m";
  G := 9.80665;
ELSE 
  str := "pies";
  G := 32.17404;
END;

//Manejo el tema del formato de los angulos
angulo := HAngle;
HAngle := 1; //Modo = grados


lista1 := {"Pos. en X:", "Pos. en Y:", "Angulo:","Vel. inicial:"};
lista2 := {"Posición inicial en X ("+str+")","Posición inicial en Y ("+str+")","Angulo alfa (grados)","Velocidad inicial ("+str+"/s)"};

INPUT ({G,H,A,V},"Condiciones iniciales",lista1, lista2);

STARTAPP("Parametric");
X1 := "G+V*COS(A)*T";
Y1 := "H+V*SIN(A)*T-G*T^2/2";

CHECK(1);

Xmin := "0";
Xmax := "G+(V^2*SIN(2*A))/G";
Ymin := "0";
Ymax := "H+(V*V*SIN(A)*SIN(A))/(2*G)";

STARTVIEW(1,1);

HAngle := angulo;

END;

when I run the program with the following data (or any other)

[Image: IIRzvF4U8_rWdkQTm6jMcmRK1oq9wLV1j5lGRea2...41-h302-no]

I get the following error:

[Image: Captura+de+pantalla+de+2013-12-26+15%253A35%253A40.png]

What am I doing wrong?

TIA. Ariel.
PD: In the second picture is a T ² * T ... It is an error in the equation, which was already corrected, and that obviously is not the cause of the problem with the program.

Greetings.
Ready!

[Image: Captura+de+pantalla+de+2013-12-27+07%253A51%253A54.png]

[Image: Captura+de+pantalla+de+2013-12-27+07%253A52%253A14.png]

[Image: Captura+de+pantalla+de+2013-12-27+07%253A52%253A33.png]

The code:

Code:
EXPORT tiro1()
BEGIN
local M,local, lista1, lista2,angulo,str;

CHOOSE(M, "Unidades", "SI", "US");
IF M==1 THEN
  str := "m";
  G := 9.80665;
ELSE 
  str := "pies";
  G := 32.17404;
END;

//Manejo el tema del formato de los angulos
angulo := HAngle;
HAngle := 1; //Modo = grados


lista1 := {"Pos. en X:", "Pos. en Y:", "Angulo:","Vel. inicial:"};
lista2 := {"Posición inicial en X ("+str+")","Posición inicial en Y ("+str+")","Angulo alfa (grados)","Velocidad inicial ("+str+"/s)"};

INPUT ({L,H,A,V},"Condiciones iniciales",lista1, lista2);


X1 := "L+V*COS(A)*T";
Y1 := "H+V*SIN(A)*T-G*T^2/2";
STARTAPP("Parametric");
CHECK(1);

Xmin := -1;
Xmax := L+(V^2*SIN(2*A))/G;
Ymin := -1;
Ymax := H+(V*V*SIN(A)*SIN(A))/(2*G);

STARTVIEW(1,1);

HAngle := angulo;

END;
Reference URL's