HP Forums
Need Help with INPUT - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Need Help with INPUT (/thread-795.html)



Need Help with INPUT - Eddie W. Shore - 03-01-2014 07:54 PM

I keep getting Error: Invalid Input and I don't get where the error is or what causes it. Does INPUT not work within loops? Any help is greatly appreciated.

Program:
Code:
 EXPORT EXPSMTH()
BEGIN
LOCAL X,A,M,D,S,P;
LOCAL K,C,L1,L2;
// L1: Actual Data, L2: Predictive Data

// Initialize
INPUT({X,A},"INITIALIZE",{"DATA:","ALPHA:"});
L1:={X}; L2:={X}; S:=S+1;

REPEAT
CHOOSE(C, "OPTIONS", "Add Point", "Delete Last Point", "Quit");

IF C==1 THEN
INPUT(X, "NEXT POINT"); // This is where the error points to.  Can't INPUT work with globalize variables? 
L1:=CONCAT(L1, {X});
S:=S+1;
END;

IF C==2 THEN
L1:=SUB(L1,1,S);
S:=S-1;
END;

RECT();
TEXTOUT_P(12,0,"# OF POINTS: "+STRING(S),2);
IF S>1 THEN
P:=L2(1);
FOR K FROM 2 TO S DO
P:=P+(L2(K)-L1(K))*A;
END;
TEXTOUT_P(60,0,"ALPHA: "+STRING(A),2);
TEXTOUT_P(72,0,"PREDICTION: "+STRING(P),2);
END;
WAIT(-1);
UNTIL C ==0 OR C==3;
END;



RE: Need Help with INPUT - Terje Vallestad - 03-01-2014 08:33 PM

(03-01-2014 07:54 PM)Eddie W. Shore Wrote:  IF C==1
INPUT(X, "NEXT POINT"); // This is where the error points to. Can't INPUT work with globalize variables?
L1:=CONCAT(L1, {X});
S:=S+1;
END;

There may be other issues, but should there not be a THEN after the C==1, similar to the rest of your code?

Cheers, Terje


RE: Need Help with INPUT - Eddie W. Shore - 03-01-2014 09:16 PM

(03-01-2014 08:33 PM)Terje Vallestad Wrote:  
(03-01-2014 07:54 PM)Eddie W. Shore Wrote:  IF C==1
INPUT(X, "NEXT POINT"); // This is where the error points to. Can't INPUT work with globalize variables?
L1:=CONCAT(L1, {X});
S:=S+1;
END;

There may be other issues, but should there not be a THEN after the C==1, similar to the rest of your code?

Cheers, Terje

Thanks - there should be. Typo on my part.


RE: Need Help with INPUT - cyrille de brébisson - 03-03-2014 07:03 AM

Hello,

Are you sure that the input is the issue?
It looks to me that your textout are problematic
> TEXTOUT_P(12,0,"# OF POINTS: "+STRING(S),2);
should be
TEXTOUT_P("# OF POINTS: "+STRING(S),12,0,2);

Cyrille


RE: Need Help with INPUT - Eddie W. Shore - 03-11-2014 01:55 PM

Thanks Cyrille! I hope to have the complete program (and it's correct syntax) posted soon.