Jump to content

Talk:COBOL/Variables

Page contents not supported in other languages.
Add topic
From Wikiversity
Latest comment: 4 years ago by Lbeaumont in topic CodeChef notes

CodeChef notes

[edit source]

I needed to take these steps to run the program

  1. Choose “COB” as the language,
  2. Add (6?) spaces to the start of each line (e.g. indent to column 7).

And then encountered this problem running this program on CodeChef.

It is not clear how to enter the Fahrenheit temperature. Simply running the program results in an output of “Enter Fahrenheit temperature:” with no (apparent) opportunity to enter input (I was trying to convert 68 from Fahrenheit to census). I then checked the “Customer Input” box and entered 68 in the window with the same results. I tried again entering 68 New Line with the same result. How can this program be run successfully on CodeChef? --Lbeaumont (discusscontribs) 02:03, 14 April 2020 (UTC)Reply

@Lbeaumont: I removed CodeChef and Ideone from the list. The code works without modification in the other three online IDEs. I recommend trying one or more of those. Each has an input or STDIN area you can add input to. Remember to press enter at the end of the input line. Some platforms also give a warning if you don't press enter at the end of the source code (end with a blank line).
Thanks, that helps. I added a brief description of the Picture clause to the example because this syntax is particular to COBOL and unlikely to be obvious to many students.--Lbeaumont (discusscontribs) 14:17, 14 April 2020 (UTC)Reply