CS253: Software Development with C++

Fall 2019

HW 1

CS253 HW1: Enemies List

Description

For this assignment, you will write a C++ program called hw1 that will read data representing an “enemies list” from standard input, and display the entries, properly formatted, to standard output.                 

Sample Runs

Here is a sample run, where % is my prompt. What you type looks like this. Ignore the indentation.                 

    % cat data
    Relation boss
    Sin      Fired me without telling me
    When     September 2018

    Title Idiot sister
    Name    Diane
    Sin Accused me of stealing from parents' estate
    When 2012-03-16


    Name    Isaac Newton
    Sin     Lucky enough to be born first and sit under a tree
    When    1666 or so

    Who Benedict Cumberbatch
    Reason ☠$%@★% sets too high a standard!
    % cmake .
    … cmake output appears here …
    % make
    … make output appears here …
    % ./hw1 <data
    Relation boss
    Sin      Fired me without telling me
    When     September 2018

    Title Idiot sister
    Name  Diane
    Sin   Accused me of stealing from parents' estate
    When  2012-03-16

    Name Isaac Newton
    Sin  Lucky enough to be born first and sit under a tree
    When 1666 or so

    Who    Benedict Cumberbatch
    Reason ☠$%@★% sets too high a standard!
    %

Input Format

Ignore any trailing tabs or spaces on all lines. An enemy is described by a number of lines, separated by at least one empty line. Each line starts with an alphabetic key, followed by some spaces, followed by a value. Neither the key nor the value may empty.                 

Output Format

Use the minimum number of spaces (but at least one) between the key and the value such that all the values (of a given enemy) line up in the same column. However, different enemies don’t have to have their values in the same column. Separate multiple enemies by a single empty line. Do not emit tabs, trailing spaces on a line, or trailing blank lines.                 

Debugging

If you encounter “STACK FRAME LINK OVERFLOW”, then try this:

    export STACK_FRAME_LINK_OVERRIDE=ffff-ad921d60486366258809553a3db49a4a

Requirements

If you have any questions about the requirements, ask. In the real world, your programming tasks will almost always be vague and incompletely specified. Same here.                 

Tar file

    cmake .
    make

How to submit your homework:

    ~cs253/bin/checkin HW1 hw1.tar

How to receive negative points:

Turn in someone else’s work.