CS253

CS253: Software Development with C++                

Spring 2018                

HW 0                

CS253 HW0: Light Bulb Joke                

Purpose                

The purpose of this assignment is to make sure that you can follow instructions, login to a Linux system, compile a C++ program, and check in homework. This way, you’re sure that your login and password work before you need them for homework #1. This assignment is not optional.                 

Description                

In this assignment, you will write a program called hw0. It will answer the question, “How many CU students does it take to change a light bulb?”                 

Sample run                

In the following example, what you type looks like this. The percent sign, “%”, is my shell prompt.                 

% cat hw0.cc

#include <iostream>

using namespace std;

int main() {
    // How many CU students does it take to change a light bulb?
    cout << "Three—one to hold the light bulb and two to debate\n"
	 << "whether an LED or a CFL bulb harms the environment more!\n";
    return 0;
}

% cat Makefile

# To compile your code, do this command: make
# To produce a tar file, do this: make tar
# To clean up: make clean

# You are required to at least use -Wall for warnings.
# More -W flags are even better.

CPPFLAGS=-Wall -Werror -Wextra -Wfatal-errors
assignment=hw0

$(assignment): $(assignment).o
	g++ $(CPPFLAGS) -o $@ $^

tar:
	tar -cv $(MAKEFILE_LIST) *.cc >$(assignment).tar

clean:
	rm -f $(assignment) $(assignment).tar *.o *.gch

% make

g++  -Wall -Werror -Wextra -Wfatal-errors  -c -o hw0.o hw0.cc
g++ -Wall -Werror -Wextra -Wfatal-errors -o hw0 hw0.o

% ./hw0

Three—one to hold the light bulb and two to debate
whether an LED or a CFL bulb harms the environment more!
%

Rules                

How to submit your homework:                

Use web checkin, or Linux checkin:                 

    ~cs253/bin/checkin HW0 hw0.tar

How to receive negative points:                

Turn in someone else’s work.                 

Modified: 2018-01-21T12:08                 

User: Guest                 

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building