Home | |
Schedule | |
Assignments | |
Lectures | |
Resources
Project 0 Specifications: ASCII ArtDue Date: Monday, February 3 This assignment is meant to get you started in C++ projects: writing code, compiling and running it, and submitting your work using our electronic submission system. You only have one week to complete this assignment. Get started early in case you have questions! Collaboration (Discussion) LogLike all work done for this course, you must keep a discussion log as you work and submit it when you are finished. Please read the course home page for details. Program DescriptionWrite a C++ program that prints a personalized birthday card with an "ASCII art" line-drawing of anything you like. ASCII art is made by just printing out a message formed from characters like 'o', '+', '|', '-', '/', and so on. Your program should start by asking the user to enter a name. Use a cout statement for this. Then your program should read the name typed by the user. Use a cin statement for this. You will also need a string variable to hold the user's name. Finally, your program should print a personalized greeting and an ASCII art drawing. So if the user had typed Frank when prompted by your program, then your program might print out "Happy Birthday Frank!" and draw a cake, or a cow. Here is an example of the output of such a program. The parts that are underlined are things typed by the user. The rest is output from the program. What is your name? kwalsh Happy Birthday kwalsh !!! Here is a cow: / \ || || \\______// | ____ | | |---------------------- | | \ / \ = | o o | | _ _ / | \ \____/ \ _ / | |\ | | | | | | | ___________________ | | | | | | | | | | | | | | | | | | | | | | | | | |v|v| |v|v| To draw in ASCII you can just use a series cout statements. The last two cout statements for the example above—used to draw the feet of the cow above—were: cout << " | | | | | |" << endl; cout << " |v|v| |v|v|" << endl; Notice that the spacing and formatting within the double-quoted strings are significant here. Place your source code in a file named artwork.cc. (Note: For grading, your project will be submitted and tested using an automated system, so the filename must be exact, including capitalization.) The source code must be a "plain text" file, not a Microsoft Word Document, PDF, or anyting else. Keep a collaboration log in a file named collaboration.txt following the guildelines detailed on the course home page. Hints and HelpGetting started. Log in to radius. During lab 1, you should have created a directory called projects directory in your home directory. Barring any floods or fires, your files and directories should still be there. Create a new directory called project0 within your projects directory. This directory is the place you should store your work for this project. You can browse to this folder on the desktop if you like. For this project, write your code in a plain text editor (look under "Applications" menu, then "Accessories", then "Text Editor") and save your work as a file named artwork.cc in the project0 folder you created. Stuck on your first C++ program? Here is a simple program. Feel free to start by typing in this code (typing is good practice here— don't use copy and paste), figure out what it is doing, then modifying it as you see fit.
Not artistic? Lots of ASCII art examples can be found here. Feel free to copy a drawing that you find online. Just be sure to cite where it came from! Compile errors? The most common compiler error seen in this project has to do with an "unknown escape sequence". Here is the likely cause of this error. Two characters in C++ have special meanings when they are used within a double-quoted string. The first special character is the double-quote (") character itself. If you want a double-quote (") to appear within your double-quoted string, put a backslash (\) character before it, like this: cout << "This is a \"long\" sentence." << endl; The other special character is the backslash. If you want a backslash to appear within your double-quoted string, put another backslash (\) character before it, like this: cout << "Here is a small mountain: /\\ enjoy!" << cout; Note that even though the code has one forward slash and two backslashes, the program output will contain only one of each. Specifications for Documentation and FormatFully correct documentation for Project 0 should include:
Program TestingYou are encouraged to compile and test your code, because it will help you catch mistakes. To compile and test your program, do this:
Submitting Your Finished Project1. When you finish, you should submit your work electronically using the submit program.
The collaboration log is expected with each and every project. Failure to turn in a log will result in deductions. You must turn in a log even if you did not discuss your project with anyone. Simply state that no discussions took place. You may submit version after version of your files electronically. Each successful submission will replace any all previously successfully submitted files. That is, only your last set of successfully submitted files will be visible to and will be graded by your instructor. 2. Print out the grading header , put your name at the top and staple it to the front of a hard copy of the artwork.cc file and the collaboration log you submitted electronically. 3. Hand in a hard copy of the file you submitted electronically along with collaboration log and the header. Hand this in to your instructor at the beginning of class on the project's due date. Get started early and have fun! Honor CodeThe honor code applies to all programming done in this course. Reread the course collaboration policy posted on the main course webpage as well as the department statement on the honor code. Ask your instructor if you have any questions about this policy. |