Comp 2673
Spring 2002
Homework 2
Due Monday, April 8
By now you should have read chapters 1-7, 10 and 12 in the Unix book,
and should be working on reviewing chapters 6-8 of Deitel and Deitel.
- What line should you type to change all of the files in your
current directory to have permissions rwxr-x---?
- If a file has 416 as the numeric representation for the permissions mode,
what are the permission settings?
-
- Add the binary numbers 111011100 and 011001001
- Add the hexadecimal numner 0x60AC and 0x7D72
- Suppose an int takes 4 bytes, and an array of ints
has memory location 0x6060F0. What is the memory location of
the 20th element of the array?
- Copy the file ~ftl/public_html/qs.xls to one of your
own directories. Compress the file. What percentage of the original size
is the compressed file? Uncompress the file and compare it (using diff)
to the original file in my directory to verify that it's the same as
the original.
- Your friend Pat wants to move some C++ software from a laptop to
the CS department machines. First you warn your friend not to be surprised
if there are some compile errors, since MSVC++ lets you get away with
non-standard C++ in some cases and g++ does not, and you also explain that
to compile and link several source and header files it helps to use make.
Pat tells you that the files for the program are studentgroup.h,
studentgroup.cpp, studentrec.h, studentrec.cpp, and studdb.cpp, and that the
executable program should be called studdb. Pat then manipulates you into
creating the makefile. Turn in the makefile.
- This problem is a review of classes. If you feel shaky on this material,
then work on re-reading chapters 6-8 of Deitel and Deitel this week and next
week. Write the declarations of two (interacting) classes, one to represent
a playing card, and the other to represent a deck of playing cards. You may
choose whether the
Card class stores the value of the card either as a single integer (for the
value of the card) or as two integers (one for suit and one for rank).
The Card class should provide at least functions for displaying (a member
function as well as an overloaded << operator), all operators for comparing
(overloaded ==, <, etc.), an assignment operator, and a construtor allowing
initialization of the value of the card. The Deck class should store the
cards as an array of pointers to Card objects. It should provide (at least)
a shuffle function, a deal function (that deals a single card), a display
function, an assignment operator, and an == operator. Both classes
should also include a default constructor, a copy constructor and a destructor.
Also in some way include two arrays of constant char *'s to store names of
suits and ranks (i.e., "Ace", "Two", etc. and "Clubs", "Diamonds", etc). Include
any constants you find necessary.
(Please note that I am not asking you to implement these classes - just give
the declarations!)
- This problem pertains to programming assignment 1. Part of the programming
assignment is to read the data files that contains information about family
relationships and store this information in a data structure in your program.
Look at the sample "pedigree" file family1 and draw
a picture of what the data structure for this list of people will look like.
Invent memory locations for each object so you can put meaningful values
in for the pointers.