CS 010 - Introduction to Computer Science I
Assignment 3:

DUE: Friday, January 28th before 7:00pm


Collaboration Policy

Collaboration is strongly ENCOURAGED. You can work in teams, but programs must represent YOUR OWN original work. Teams can work on the algorithm together and help debug/test each others code. However, copying code from ANY source (any book, current or past students, past solutions, the web, etc.) is STRICTLY FORBIDDEN. Code between teamates might be similar, but you are not allowed to just copy and paste a teamate's solution.  Also, just changing the variable names and spacing from someone elses code is considered cheating, and will result in at least a zero for the assignment.


Code that is turned in, must be contained in a .cpp file named main.cpp. Files of ANY other format will not be graded (e.g. main.doc, main.txt, etc…).

You must turn your work in using electronic turnin, from a computer on campus.

Turn in online to as3 folder. If you turn your assignment in to the wrong folder, your assignment may not be graded. If it is graded, you will lose 2 pts (out of 10).

If your program doesn't compile using the compile command as specified below, your program will not be graded!

Remember to include the following header information at the top of your program;

// Course: CS 10
//
// Lecture Section: ... 001 or 002
// Lab Section: ... 021, 022, etc)
//
// Assignment #: ... assignment 2, 3, etc.
//
// Last Name: Enter your LAST (family) name here (eg, Doe)
// First Name: Enter your FIRST (given) name here (eg, John)
//
// ID Number: Enter your ID number here (eg, 860-00-0000)
// lab login id: Enter your cs10 login here (eg, jdoe)
//
// Email address: Enter your UCR email address here (eg, jdoe@cs.ucr.edu)
//
// Teammates: List the names of the teammates you worked with

// =======================================================================




Problem Definition:

For this assignment you will write a program that draws a picture. The picture must have 3 different elements; a space ship, a landscape, and a big C on the landscape (below is an example). You can draw the ship and landscape any way you like, so be creative! To create the images, and print the C, you will need to include the "ccc_win.h" library in your program. You are required use the following functions; Point, Line, and Message. The code sample below draws a line, and prints a message to the window:

#include "ccc_win.h"

int ccc_win_main()
{
    //set window coordinates (pg. 98)
    cwin.coord(0, 1000, 1000, 0);

    //start and end point of line
    Point p0(250, 500);
    Point p1(750, 500);

    //location of message
    Point msg_loc(250, 600);

    //draw a line from point p0 to p1
    cwin << Line(p0, p1);

    //print a message
    cwin << Message(msg_loc, "I just drew a line");

    return 0;
}

Now that we are using graphics, you need to make changes to the way you've been compiling and running your program, you also need to use ccc_win_main(), instead of main() at the start of your program (as in the sample code above). To compile the program now, type "compile" on the command line instead of "g++ main.cpp". To run the program now type "main" instead of "a.out".


Example program run displaying picture:

example_pic




Rubric: (10 pts total)

2 pt(s): Draws a ship with at least 4 lines
2 pt(s): Draws a landscape with at least 7 lines
3 pt(s): Uses Point and Lines functions to draw ship and landscape
1 pt(s): Prints a C on the landscape with Message function
2 pt(s): Style
- comments
- line wraps
- spacing
- Indentation
- Good constant/variable names
- No magic numbers

Note that you will lose points for style on this assignment!
For coding style requirements see the following link:
http://www.cs.ucr.edu/cs10/cs10_05win/requirements/coding_std.html