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;
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;
(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.
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 :-)
(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.
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