EE 312 -- Project 3

ASCII Art: Problem Decomposition, functions and nested loops

This is an individual assignment - you cannot work with anyone else. All work must be done on your own. Ask the instructional staff if you need help.

Due: By 11 pm, Tuesday, September 25

Make sure that you are following the project style guide.

The purpose of this project is for you to:
1. Generalize a problem.
2. Decompose a complex problem into simpler parts.
3. Practice writing functions.
4. Practice using program constants.
5. Practice using nested for loops.


Create a program that produces an ASCII art representation of a rocketship. The output will vary based on a constant in the program. By changing the constant, the output will change dramatically. Your program must match the outputs shown for the given value of the SIZE constant exactly. Here is the program output when the SIZE constant is set to 3:

     /**\
    //**\\
   ///**\\\
  ////**\\\\
 /////**\\\\\
+=*=*=*=*=*=*+
|../\..../\..|
|./\/\../\/\.|
|/\/\/\/\/\/\|
|\/\/\/\/\/\/|
|.\/\/..\/\/.|
|..\/....\/..|
+=*=*=*=*=*=*+
|\/\/\/\/\/\/|
|.\/\/..\/\/.|
|..\/....\/..|
|../\..../\..|
|./\/\../\/\.|
|/\/\/\/\/\/\|
+=*=*=*=*=*=*+
     /**\
    //**\\
   ///**\\\
  ////**\\\\
 /////**\\\\\

When the SIZE constant is changed to 7, the following output is produced:

             /**\
            //**\\
           ///**\\\
          ////**\\\\
         /////**\\\\\
        //////**\\\\\\
       ///////**\\\\\\\
      ////////**\\\\\\\\
     /////////**\\\\\\\\\
    //////////**\\\\\\\\\\
   ///////////**\\\\\\\\\\\
  ////////////**\\\\\\\\\\\\
 /////////////**\\\\\\\\\\\\\
+=*=*=*=*=*=*=*=*=*=*=*=*=*=*+
|....../\............/\......|
|...../\/\........../\/\.....|
|..../\/\/\......../\/\/\....|
|.../\/\/\/\....../\/\/\/\...|
|../\/\/\/\/\..../\/\/\/\/\..|
|./\/\/\/\/\/\../\/\/\/\/\/\.|
|/\/\/\/\/\/\/\/\/\/\/\/\/\/\|
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
|.\/\/\/\/\/\/..\/\/\/\/\/\/.|
|..\/\/\/\/\/....\/\/\/\/\/..|
|...\/\/\/\/......\/\/\/\/...|
|....\/\/\/........\/\/\/....|
|.....\/\/..........\/\/.....|
|......\/............\/......|
+=*=*=*=*=*=*=*=*=*=*=*=*=*=*+
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
|.\/\/\/\/\/\/..\/\/\/\/\/\/.|
|..\/\/\/\/\/....\/\/\/\/\/..|
|...\/\/\/\/......\/\/\/\/...|
|....\/\/\/........\/\/\/....|
|.....\/\/..........\/\/.....|
|......\/............\/......|
|....../\............/\......|
|...../\/\........../\/\.....|
|..../\/\/\......../\/\/\....|
|.../\/\/\/\....../\/\/\/\...|
|../\/\/\/\/\..../\/\/\/\/\..|
|./\/\/\/\/\/\../\/\/\/\/\/\.|
|/\/\/\/\/\/\/\/\/\/\/\/\/\/\|
+=*=*=*=*=*=*=*=*=*=*=*=*=*=*+
             /**\
            //**\\
           ///**\\\
          ////**\\\\
         /////**\\\\\
        //////**\\\\\\
       ///////**\\\\\\\
      ////////**\\\\\\\\
     /////////**\\\\\\\\\
    //////////**\\\\\\\\\\
   ///////////**\\\\\\\\\\\
  ////////////**\\\\\\\\\\\\
 /////////////**\\\\\\\\\\\\\


Note that in the original rocketship, the various subfigures have a height of 3. The height of these subfigures also determines their width, so there is only one constant needed for the size of the rocket. You must use a constant (a const int variable) to make it possible to change a single number in one place in the program to produce a rocket with a different size. Note that the larger example rocket above has size of 7.

Here is the output for SIZES 4 (rocket4.txt), 5 (rocket5.txt) and 6 (rocket6.txt). 

This assignment is meant to give you practice with the constructs that we have been using in class (constants, printf() statements, functions, decomposition, loops, and nested loops.) Do not use strings (i.e., char array variables.) This will require you to create nested for loops with printf() statements that use the constant and local variables. Do not use other constructs. Do not write functions that take parameters or return values - the goal is for your code to use the constant. Do not use conditional statements (if, if/else, switch.)

Your program design - how you structure your solution - is just as important as your output. Write psuedocode for your solution before you start coding. Write down charts for your nested loops as we've been doing in class.

You will use functions to structure your solution. Avoid significant redundancy and structure your program so that the functions match the structure of the output itself. You must follow the style guide for EE 312, or you will lose points. You should localize variables whenever possible. Your (only) constant should be named SIZE. Do not alter the following except for the actual literal int used to initialize SIZE (3, 4, ...)

const int SIZE = 3;


Include the following header at the top of your Rocketship.c file. You must complete this header with your name to receive credit for the assignment.

/*
 *  EE312 Assignment 3.
 *  On my honor, <NAME>, this programming assignment is my own work.
 *
 *  A program to print out a Rocketship in ASCII art form.
 *
 *  Name:
 *  email address:
 *  UTEID:
 *  Section 5 digit ID:
 *  Number of slip days used on this assignment:
*. Total number of slip days used this semester:
 */

On any given execution your program will produce only one version of the rocketship, though it will be possible to change the constant to have the program produce a figure of a different size. The program you submit should produce the first rocketship displayed above (i.e., the one with size 3). We will change your constant when grading your project. Your output must produce the correct output for a variety of choices of SIZE or you will lose points for correctness. Use a diff tool such as the one at this website ( www.quickdiff.com) to ensure your program produces the correct output.

When you are finished, submit your Rocketship.c file on Canvas. 



Did you remember to: