• Project 1

    Project 1 introduces C++ concepts by providing a core class, "Iclass," that you may use as the beginnings of your projects. This class includes functions for basic constructiors, destructors, file access, overloaded equal, and overloaded addition functions. An executable file that adds 64 to every pixel in the image is also provides along with a Makefile for building the program. See the readme file in "tarfille".

  • Download project

    When you have downloaded the project, the command "tar -xvf p1.tar" will create a directory "p1" containing the project code. Read the readme file.

  • Project tasks:
  • Use "snapshot" for printouts
  • Note "xmag" is a useful utility, try running it.
    The left mouse button can be used to measure pixel coordinates. If the top of xmag is a multi-line menu bar rather than a single line, and if the coordinate feature doesnt work -- type the following line before running xmag:

    setenv XAPPLRESDIR $HOME/xappdef:/usr/openwin/lib/app-defaults

    or, if XAPPLRESDIR is already set in your environment, type:

    setenv XAPPLRESDIR $XAPPLRESDIR:$HOME/xappdef:/usr/openwin/lib/app-defaults

    You can add this to your .cshrc file.

  • Get the basic program running. Press the f1 key 4 times in succession. Observe the terminal printout as you proceed. Explain the results observed.
  • Modify the program to create an Iclass function to divide by a constant, Iclass operator/(int). (An overloaded divide "/" operator).
  • Use the above to divide the pepper image by two and explain the result. Use the f2 button and create a program similar to to implement this. Print this out, and hand it in. Print out on a good laser printer where images are clear.
  • Use the overloaded "+" and "/" operators to divide the pepper and wheel image by two, then add the two images together and explain the result. Use the f3 button (hard-code the reading of wheel, and let the first image be whatever is displayed). Print this out, and hand it in.
  • Write code to create a "negative" of the pepper image, making dark areas light, and light dark. Use the f4 button. Print this out, and hand it in.
  • In the original f1 program, a line of code was commented out "y.dplus(15,125,250);". Activate this line, and deactivate the "y=x+64" line. This should print a "+" in the upper middle of the top dark pepper in pepper.img. Print this out. Also, label the x and y coordinates on the image after doing more experiments with the dplus() function. Include a label of the origin (x=0,y=0).
  • Include all explanations with the results, and turn in one week after we finish the Lab. Include the code for your overloaded divide function (NOT ANYTHING ELSE!!"). Write your explanations directly on the printout; 2 or 3 sentences should suffice for most explanations. DO NOT TURN IN EXTRA SHEETS! ESPECIALLY DO NOT HAVE SEPARATE TYPED OR HANDWRITTEN SHEETS, UNLESS SPECIFICALLY REQUESTED.

  • Other information

  • Tips on using Devguide

  • Copyright information