CS 112b
Spring 2004
Ileana Streinu
Lab 2
More Unix tricks
Basic Software Engineering Principles
Review of C statements, functions and arrays
Read the whole lab before starting working on it, so that you
know what you are required to do by the end of the lab.
Part I:
Pipe in input data to a program from a
data file
- Do this work in a directory named Lab2. If you need
files from a previous lab, copy them here.
- Copy and run your first program (ex1.cpp) from Lab1,
and write down all the keys you
pressed to enter input data for it. For example, you might have
entered something like:
6 3
or perhaps:
6
3
- Create (in emacs) a file named data containing EXACTLY these
characters.
- Now run your program again with the input piped in from this
file, as follows:
a.out < data
- It should work exactly as it did before, when you entered the
data directly from the keyboard. If it doesn't, ask me to look at
it.
- Create a typescript named
typePart1 showing the execution with the data file piped in,
and submit it in Lab2 together with the other files.
Part II:
Start working on Hw1
Read the homework 1. Make sure you
understand it. Start working on it. Submit in Lab2 as soon as you are
done with any part of it. This is just for me (you will not be
graded for this):
I want to see how many of you were able
to complete parts of the homework during lab time. You MUST
submit all the homework later, in Hw1, as specified in the
Hw1 handout.
Check list:
You are required to submit, for both Part I and Part II:
- The source files .cpp
- A typescript showing their compilation and execution.