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.                 
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?”
                
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. CXXFLAGS=-Wall -Werror -Wextra -Wfatal-errors assignment=hw0 $(assignment): $(assignment).o g++ $(CXXFLAGS) -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! %
<stdio.h>
or <cstdio>
facilities,
such as printf
, puts
, or putc
.
cout
.
hw0.cc
.
.cc
, not .cp
, .cxx
, .cpp
, .CPP
, .c++
, or .C
.
Makefile
that look like they start
with eight spaces? Those are tab characters. It matters.
Makefile
must use at least -Wall
when compiling.
Use web checkin, or Linux checkin:                 
~cs253/bin/checkin HW0 hw0.tar
Turn in someone else’s work.                 
User: Guest