index | submit | rank | book

hi1 – Hello, You! (easy version)

Hello, <You>!

Write a program that reads a single name from the standard input device and prints Hello, <Name>! on the standard output device. The standard input and output devices are usually the keyboard and screen of a command line session.

$ ./hi1
Hello, John!

$ ./hi1
Hello, Mary!

Input and Output

Input consists of a single line with a person’s given name without spaces. This name is composed of letters of the English alphabet and contains at most 30 characters.

Output should contain a single line with Hello, <Name>!. This line is proper and should be terminated by a line break.

Example input 1


Example output 1

Hello, John!

Example input 2


Example output 2

Hello, Mary!


Submit your solution to be graded according to the following list:


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:

  1. 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.

    Your program should not print messages like Please type your name:. Instead, just print the required Hello, <Name>! message. Watch out for the correct punctuation and casing and be sure to include a line break.

  2. Exit immediately: Your program should print Hello, <Name>! then exit immediately. Do not use system("pause"), sleep(1) or anything of sorts.

  3. Redirecting input: On most systems (Windows / Linux / OS X), it is possible to redirect the standard input and output of your program to files, like so:

     $ ./hi1 <inputfile.txt >outputfile.txt

    So, if you create a plain text file with a name, the above command will produce another plain text file with a hello message.

    This is actually how the automated judge runs your program.

  4. Windows users: On Windows, you should not use ./ to run a program in the current directory, do instead:

     C:\> hi1.exe
     Hello, Joseph!
  5. Easier exercises: If you have difficulty with this exercise, try the hello exercise first.

try first: hello

try also: repeat1

try next: age1

index | submit | rank | book

Copyright © 2020-2021 Rudy Matela
All rights reserved