-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I am an IGCSE student, taking Computer Science this year. This is the best Pseudocode compiler website I have found on the internet. Thank you for your effort for making this website.
I am facing this issue where the compiler is not showing the OUTPUT on the terminal before prompting me for an INPUT.
Here is my code:
DECLARE TotalPlayer:INTEGER
DECLARE TotalHoles:INTEGER
DECLARE CoursePar:INTEGER
DECLARE CorrectionOption:BOOLEAN
TotalPlayer ← 0
//Prints a message
OUTPUT "Please enter number of players (2, 3, 4): "
REPEAT
//Prompts for an input
INPUT TotalPlayer
IF TotalPlayer<2 OR TotalPlayer>4 THEN
//Prints a warning message if condition not met
OUTPUT "Please enter a number 2 to 4"
ENDIF
UNTIL TotalPlayer>=2 OR TotalPlayer<=4
DECLARE PlayerName:ARRAY[1:4] OF STRING
DECLARE PlayerIndex:INTEGER
FOR PlayerIndex ← 1 TO TotalPlayer
//Prints a message
OUTPUT "Please enter name of player", PlayerIndex
//Pauses and prompts an input
INPUT PlayerName[PlayerIndex]
NEXT PlayerIndex
REPEAT
//Prints a message
OUTPUT "Please enter a number of holes to be played (9 or 18): "
//Pauses to prompt for an input
INPUT TotalHoles
IF TotalHoles<>9 AND TotalHoles<>18 THEN
//Prints a warning
OUTPUT "Please enter 9 or 18."
ENDIF
UNTIL TotalHoles=9 OR TotalHoles=18
The compiler prompted me for inputs before printing any outputs without pause.
Expected behaviour:
- Outputs "Please enter number of players (2, 3, 4): "
- Prompts for an input (2, 3, 4 is to be accepted)
- If the input is not 2, 3 or 4, a warning message is outputted and input is prompted again.
- When input is valid, move on. If not, output a warning message and prompt input again.
- Outputs "Please enter name of player", PlayerIndex (player1, player2.... and so on)
- Prompts for an input
- Repeats until all player's names are input, move on
- Outputs "Please enter a number of holes to be played (9 or 18): "
- Prompts for an input, only 9 or 18 to be accepted.
- If input is not 9 or 18, a warning message is output and input is prompted again.
- If input is 9 or 18, move on.
- END of code.
Metadata
Metadata
Assignees
Labels
No labels