On Your Own Programming Assignment
September 1997 - Fell
Goals
You will learn to create your own program, starting with a shell that has only the
necessary #includes. In particular, you will:
- write your own functions and function prototypes
- use simple IO
- use simple graphics commands
- write appropriate comments.
Getting Started
- Find the folder "OnYourOwn " and copy it to the desktop.
- Run the application program "OnYourOwnSolution".
Your final program should be something, but not exactly, like this. There will be
three parts to your program: Credits, Chatting with the user, Drawing a picture.
- Double click on the project "OnYourOwn. " to open the CodeWarrior IDE.
- Double click on "OnYourOwn.cp" in the project window. The source code file should appear.
Your Tasks
Locate the lines:
// Author: Your Name goes here
// Date: Today's date goes here
and enter your name and the actual date .
Create a function main and run your program. It won't do anything yet but you will know that you have typed the function correctly and have no syntax errors so far. At this point, your main function can be as simple as:
main()
{
}
Add two calls to main,
BigSquarePair(); // this be the first call
PressReturn(); // this will be the last call
and run your program again. This time, you should see drawing and text windows.
Add a Credits function. Refer to the warmup program to see what your credits function should look like. You must do three things to make your Credits function work:
- Write a prototype for the function under the heading:
// FUNCTION PROTOTYPES
- Write the Credits function definition below main.
- Add a call in main to your Credits function.
Run your program again to make sure your Credits function works.
Add a Chat function. You will need to declare a variable to hold the user's name.
char name[30]; // name can be up to 29 characters
Use cout to write a prompt to the user and the following to read the reply.
cin.getline(name, 30); // read name
Remember that you must have a function prototype, a function definition, and a call
to the function in main. Run your program and make sure its works before you go on.
Add a MyPicture function. Your picture does not have to be as complicated as mine. You must use at least 20 graphics calls, e.g. PaintRect, SetForeColor, . . .
Here's a link to Some Basic Graphics Commands.
Do NOT copy my picture. Make this your own picture.
Make sure that your program has suitable comments. It's easiest to write the comments as you go but add them now if you didn't before.
This program is due at your next lab, Tuesday, September 23, or Wednesday, September 24, depending on you section.
Turn In:
- Diskette with a folder including:
- Source code
- Project
- Working application
- Printouts of:
- Your source code
- A screen snapshot showing your drawing and chat.
To Make a Screen Snapshot
Hold down the "Shift" and keys and press 3. You may hear a snapshot click.
Double click on the hard disk icon on your machine to open the main window.
Find an icon named "Picture 1". If there are several picture icons, locate the
one with the highest number. That's the one that was just taken. Double click on
it.
- Select "Page Setup" from the file menu.
- Type 80% where it says 100%
- Change the Orientation to Landscape mode.
- Print
Backup your work. Do not leave your files on the machine. Put them in the trash
and empty the trash.
Last Updated: September 28, 1997 11:45 am by
Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is:
http://www.ccs.neu.edu/home/fell/COM1100/HW/OnYourOwn.html