HP Forums
Problems with INPUT, need some help - 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: Problems with INPUT, need some help (/thread-18551.html)



Problems with INPUT, need some help - Powersoft - 07-12-2022 11:55 AM

I have a simple INPUT, of date items and one real item.
The last is the variable GMT.
How should I change the INPUT so the GMT change will be work.

Cheers,
Jan

Code:
EXPORT Test_Input()
BEGIN
  LOCAL jaar :=floor(Date),
  LOCAL maand:=floor((Date-floor(Date))*100);
  LOCAL dag  :=floor((Date*100-floor(Date*100))*100);
  LOCAL GMT  := -2; // Amsterdam at summertime
  INPUT({jaar,maand,dag,GMT},"Date",{"Year?","Month?","Day?","GMT?"},{"Year","Month","Day","GMT"}, {Date,Date,Date,Date});

  PRINT();
  PRINT("jaar:"+jaar);
  PRINT("maand:"+maand);
  PRINT("dag:"+dag);
  PRINT("GMT:"+GMT);
END;



RE: Problems with INPUT, need some help - matalog - 07-13-2022 01:28 PM

This works, the non-simple versions of Input isn't so simple.

Code:
EXPORT Test_Input()
BEGIN
  LOCAL jaar :=floor(Date);
  LOCAL maand:=floor((Date-floor(Date))*100);
  LOCAL dag  :=floor((Date*100-floor(Date*100))*100);
  LOCAL GMT  := -2; // Amsterdam at summertime
  INPUT({jaar,maand,dag,GMT},{"Year?","Month?","Day?","GMT?"});

  PRINT();
  PRINT("jaar:"+jaar);
  PRINT("maand:"+maand);
  PRINT("dag:"+dag);
  PRINT("GMT:"+GMT);
END;



RE: Problems with INPUT, need some help - Powersoft - 07-13-2022 01:57 PM

(07-13-2022 01:28 PM)matalog Wrote:  This works, the non-simple versions of Input isn't so simple.

Code:
EXPORT Test_Input()
BEGIN
  LOCAL jaar :=floor(Date);
  LOCAL maand:=floor((Date-floor(Date))*100);
  LOCAL dag  :=floor((Date*100-floor(Date*100))*100);
  LOCAL GMT  := -2; // Amsterdam at summertime
  INPUT({jaar,maand,dag,GMT},{"Year?","Month?","Day?","GMT?"});

  PRINT();
  PRINT("jaar:"+jaar);
  PRINT("maand:"+maand);
  PRINT("dag:"+dag);
  PRINT("GMT:"+GMT);
END;

Thanks, this is realy simple.


RE: Problems with INPUT, need some help - Tyann - 07-13-2022 05:57 PM

Bonjour

J'ai déjà pensé à écrire un programme qui faciliterait la programmation des INPUTS
un peu compliqués, une sorte d'assistant qui renverrai à la fin la ligne de commande
sous forme de chaîne de caractères ou de note que l'on pourrai copier/collé dans nos
programmes.
Sans doute faudrait-il beaucoup de INPUT pour réaliser celà :-)

Hello

I've already thought of writing a program that would facilitate the programming of INPUTS
a bit complicated, a kind of assistant that would return at the end the command line
in the form of a string or a note that we could copy/paste into our
programs.
It would probably take a lot of INPUTS to do this :-)


RE: Problems with INPUT, need some help - Powersoft - 07-14-2022 10:24 AM

(07-13-2022 01:28 PM)matalog Wrote:  This works, the non-simple versions of Input isn't so simple.

Code:
EXPORT Test_Input()
BEGIN
  LOCAL jaar :=floor(Date);
  LOCAL maand:=floor((Date-floor(Date))*100);
  LOCAL dag  :=floor((Date*100-floor(Date*100))*100);
  LOCAL GMT  := -2; // Amsterdam at summertime
  INPUT({jaar,maand,dag,GMT},{"Year?","Month?","Day?","GMT?"});

  PRINT();
  PRINT("jaar:"+jaar);
  PRINT("maand:"+maand);
  PRINT("dag:"+dag);
  PRINT("GMT:"+GMT);
END;

When I put in an negative number got an error "error: invalid input", when I put a positive number it is accepted!
When setting the calculator setting to schoolbook or algebraic then the negative number is accepted.


RE: Problems with INPUT, need some help - roadrunner - 07-14-2022 11:52 AM

Try this:

INPUT({{jaar,[0]},{maand,[0]},{dag,[0]},{GMT,[0]}},{"Year?","Month?","Day?","GMT?"});

for the input line so it only accepts floats. It worked for me in textbook, algebraic, and rpn modes.

-road