Write a program that prints “Hello, World!” on the standard output device. Normally, the standard output device is the screen of a command line session:
$ ./hello
Hello, World!
No input should be read.
The output should contain a single line with the Hello, World!
message.
This line should be terminated in a line break.
Create a new user then submit your solution to be graded according to the following list:
For a full score of 6/6,
just print Hello, World!
and exit.
You should not do anything else.
If you do not know where to start, read the Computer Science by Example book. First, setup your environment then learn the programming basics. Here are some hints:
Automated judge: Keep in mind that when your program is submitted it will not be run by a human but instead by an automated judge. Instructions should be followed exactly or the judge will not give you a full score.
Watch out for correct punctuation,
the space after the comma
and the required line break:
Hello-comma-space-World-exclamation – Hello, World!
Exit immediately:
Your program should print Hello, World!
then exit immediately.
Do not use system("pause")
, sleep(1)
, print('Press any key to continue')
or anything of sorts.
Redirecting output: On some systems (Windows / Linux / OS X), it is possible to redirect the output of your program to a file, like so:
$ ./hello >outputfile.txt
Windows users:
On Windows, you should not use ./
to run a program in the current directory,
do instead:
C:\> hello.exe
Hello, World!
Help! I can’t solve this exercise. If you got a score of 0/6, 1/6, 2/6, 3/6, 4/6 or 5/6 just try again! Reread the exercise description and make sure you do exactly what is described and only what is described in the “Input and output” section here. The Computer Science by Example book has a section “Your first program” explaining how to solve this exercise step-by-step. It has example solutions in Python, C and Haskell. It will help you get that 6/6 score.
Copyright © 2020-2023 Rudy Matela
This text is available under the CC BY-SA 4.0 license.
Originally available on cscx.org/hello