Programming Assignment 02 Solution





* Demonstrate (elementary) understanding of how to write,

compile, and run a program in two additional useful languages,

C and C++.



* Just two “Hello, world!” programs to ensure that you have a

working environment for the languages C and C++.



1. Download from Blackboard.

2. Unzip the file somewhere convenient.

3. Change ‘dalioba’ in the name of the directory to your NetID.

(Your NetID is three letters followed by four or five digits.

The directory name will now be something like

‘hmwk_02_abc1234’ but with _your_ NetID in place of


4. Look in that directory.

5. Change the header lines in the files hmwk_01.c / .cc.

— Line 1: Family name first, then a comma, then

personal name.

— Line 2: Your NetID.

— Line 3: The date you edited the file.

6. Change line 9 in the hmwk_02.c file to be whatever is

necessary to print “Hello, world!” when this C program is

compiled and run.

7. Change line 11 in the file to be whatever is

necessary to print “Hello, world!” when this C++ program is

compiled and run.



Make a zipfile of your ‘hmwk_02_abc1234’ directory (with your

source files in it) and submit it on Blackboard as your results

for this assignment.

Your submission will be run and you will score 1 point for a

running program and 1 point for the correct output.

Therefore, the maximum possible score for this homework assignment

is 4 points (= 2 + 2).

You can get dinged points for work not in the proper format so

even if your programs work (and work correctly!), you might not

earn full credit. Check your work!



1. Ensure your programs compile and run correctly. Not

compiling or not generating the correct output

(“Hello, world!”) will cost you points. Compare your program

output to that shown in the results.txt file. Match it

EXACTLY. (‘EXACTLY’ means absolutely character-by-character

the same: those thirteen characters then a newline.)

2. Ensure that you update the three header lines in each of the

source files with YOUR name (family name first, then a comma,

then your personal name), YOUR NetID, and the date you edit

the file.

Not updating the header lines properly will cost you points.

3. Ensure your submission is packaged EXACTLY as described above.

— Your submission should be a ZIP FILE (not a tar, rar, gz,

or any other kind of compressed file).

— The zip file should be named ‘’ (with

‘abc1234’ replaced with YOUR NetID).

— This zip file should have ONE item in it, a directory

named ‘hmwk_02_abc1234’ (with ‘abc1234’ replaced with


— Your source files should be in that directory. The

source files should be named hmwk_02.c / .cc.

Submissions in the wrong format score ZERO points.

4. After you submit your zip file on Blackboard, download it

from Blackboard and check that your submission is in the

proper format, that the programs run and print the correct

string, and that you updated the header lines correctly in

each of the source files.

5. Are you CERTAIN you complied with all of these nit-picking

instructions? Really? Maybe you ought to check just one

more time. 🙂


error: Content is protected !!