CS2141 Program One
Due: Friday, 21 May 2010, at 11:59pm
For this first assignment you are to create an "ASCII art" program which
displays a variation of the same shape given different input values. To
receive full credit, you must use all of the listed components in your
program.
The point of this assignment is to get used to the basic components of
C++, practice using the submit program and to get used to the required
coding style.
Details
Input
The input will be read from the terminal using cin:
int a;
cin >> a;
If multiple, whitespace separated numbers are supplied at once,
>> will give them to you one at a time. No fancy parsing is necessary.
To make it easier to test your program you can also put all the input in
a file and pipe the file to the program (the program will treat the
contents of the file as if it was typed on the keyboard). This way you
don't have to type the test data every time you want to test your
application. If the test data was put in "prog1.test" you can run your
program like this:
./prog1 < prog1.test
The format of the input will be as follows:
- A series of positive integers (all < 64) seperated by spaces
and line breaks (enters).
- A 0 (zero) will be used to indicate the end of the input, and should
cause the program to exit.
Example input
5 4 9 1 2 50 0
Output
The output of the program is your creation. It must follow these
simple rules:
- The size of the diagram should be 5n x 5n, where
n is the input value.
- The diagram should include at
least 4 different characters, including '\'.
- The diagram should scale depending on the input (that means thickness
of "lines", too).
Here is an example of how a diagram should scale. Use something other
than this example in your program:
Input
|
1
|
Output
|
/---\
|.0.|
|..0|
|000|
\---/
|
Input
|
3
|
Output
|
///---------\\\
///---------\\\
///---------\\\
|||...000...|||
|||...000...|||
|||...000...|||
|||......000|||
|||......000|||
|||......000|||
|||000000000|||
|||000000000|||
|||000000000|||
\\\---------///
\\\---------///
\\\---------///
|
Additional Requirements
In addition to the output requirements above, your program must also
follow these guidelines:
- Your main function must
be implemented in the file prog1.cpp.
- You must use at least one function of your own in addition to
main
- Your function(s) must be defined in funcs.cpp with the prototype(s) in
funcs.h. Be sure to
#include the header file in
prog1.cpp
- You must make use of at least one array (I would recommend a
char[] or char[][] but it is up to you.)
- You must include the iosteam library, and may use
string. All other code
must be your own.
- Including the line using
namespace std; after the #includes is recommended but not
required
- Variables, functions, and indention must follow the Code Style Guidelines
- No global variables. Global constants are okay, just make sure
they're declared const.
- If you create any classes, they should be in their own file(s) with a
matching name. There must also be a header file (.h) that contains
prototypes for all functions and methods. This header file must be
included (#include) in prog1.cpp.
- The grading scale I will use is here.
- A Makefile is not required for this assignment. To compile use
g++ prog1.cpp funcs.cpp
Hopefully Helpful Hints
- Start Early! It's okay to finish early.
- To access a "lab" machine remotely ssh to: joshua.csl.mtu.edu
- We will be using submit to turn in programs. In a terminal,
type submit, then choose the class, then the section, then the
program assignment, then the files you want to turn in.
- Make sure you comment your code! Proper documentation and formatting
is an important part of your grade.
- If you need help, you can ask your instructors or go to the learning
center.
Have fun, and remember that all the usual rules regarding cheating and
cooperation are in full effect for this program.
This page last updated 12 May 2010