How to resolve the algorithm User input/Text step by step in the XPL0 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm User input/Text step by step in the XPL0 programming language

Table of Contents

Problem Statement

Input a string and the integer   75000   from the text console. See also: User input/Graphical

Let's start with the solution:

Step by Step solution about How to resolve the algorithm User input/Text step by step in the XPL0 programming language

Source code in the xpl0 programming language

string  0;              \use zero-terminated strings, instead of MSb terminated
include c:\cxpl\codes;
int     I;
char    Name(128);      \the keyboard buffer limits input to 128 characters

[Text(0, "What's your name? ");
I:= 0;
loop    [Name(I):= ChIn(0);                     \buffered keyboard input
        if Name(I) = $0D\CR\ then quit;         \Carriage Return = Enter key
        I:= I+1;
        ];
Name(I):= 0;                                    \terminate string
Text(0, "Howdy "); Text(0, Name); Text(0, "! Now please enter ^"75000^": ");
IntOut(0, IntIn(0));  CrLf(0);                  \echo the number
]

  

You may also check:How to resolve the algorithm FASTA format step by step in the Aime programming language
You may also check:How to resolve the algorithm Non-continuous subsequences step by step in the Prolog programming language
You may also check:How to resolve the algorithm Return multiple values step by step in the Agena programming language
You may also check:How to resolve the algorithm Matrix transposition step by step in the J programming language
You may also check:How to resolve the algorithm Date format step by step in the CoffeeScript programming language