This assignment asks you to solve problems using recursion.  You need
to submit answer04.c through Blackboard.  You can submit only
answer04.c.  If you change pa04.c or pa04.h, your change will be
ignored in grading.

The teaching staff have office hours everyday Monday to Friday. If you
need help, please go to the office hours.  

The teaching staff will not debug your code.  Do not send your program
to the teaching staff and ask them to debug for you.

Copying code is strictly forbidden.  If you copy code, you will
receive F in this course and your case will be reported to the
department.

The deadline is enforced by Blackboard. If Blackboard marks your
submission as late, your submission will not be graded and you will
receive zero.  Being late by one second is late.

You can submit as many times as you wish before the deadline.  If you
want to resubmit, you need to withdraw your earlier submission first.
Blackboard does not keep the files you withdraw.  If you withdraw
without resubmission, it would be impossible for the teaching staff to
retrieve an earlier version for grading.

Submission by email is not accepted.

You should not think that a program is correct if it can generate a
correct output for one test case.  It is possible that the program
fails for some other test cases.  Moreover, a program may be wrong
even if it can generate a correct output.  A program may have some
hidden problems.  The most common hidden problems are

* memory leaks 
and
* invalid memory accesses

The indexes for an array start from 0, not 1.  If an array has n
elements, valid indexes are 0, 1, ..., n-1.  If you use n as an index,
the program may appear working in some cases.  However, the program is
wrong.  Some tools can detect such problems.  If such a problem is
detected during grading, you will lose points.

You will not receive 99% of the point if the program is "99% correct".
If it is "99% correct", it is wrong. That "1%" mistake may crash your
program during grading and you will receive zero.

You should initialize all variables.  If a variable is not
initialized, its value is garbage and the program's behavior is
undefined.

If your program fails in grading, you will receive zero.  It does not
matter whether your program works when you test it.

You will lose one point for each gcc warning message.  If your program
has any warning message, you should fix the problems and remove the
warning message first.  Do not ignore warning messages and think you
can fix them later (after you "finish" debugging).  In many cases, the
warning messages indicate the bugs.

Read your program line by line before you test it.

If your program has any problem, read your program before you try to
debug.  You will not be able to debug your program by testing it.

=============================================================
This assignment asks you to solve the following problems:

* partition a positive integer with different restrictions

You should change only answer04.c.  You can add more functions in
that file. Do not modify pa04.h or pa04.c.

Please check the sample outputs in expected directory for the formats.

You can test your functions with your own input file.

input file format:
<method> <value to partition>

methods:
1. All
2. Increasing
3. Decreasing
4. Odd
5. Even
6. OddAndEven
7. Prime

usage: ./pa04 <input file>

Example file "test.in" (the following line):
1 3

Example execute command (on the following line):
./pa04 test.in


Your program must provide a general solution.  Suppose n is the number
of the elements in the original set, you cannot do anything like

   if (n == 3)
   {
      ...
   }

   if (n == 4)
   {
      ...
   }

   if (n == 5)
   {
      ...
   }

This solution is not general.  You will receive zero if you do so.


-----------------------------------------------------

Partitioning an integer means breaking the integer into the sum of
some positive integers (including the integer itself).

For example, 3 can be partitioned into
   1 + 1 + 1 
   1 + 2
   2 + 1
   3

Your solution must be general.  You will receive zero if you hard code
the answers for some cases, something like the following:

   if (n == 3)
   {
     printf("1 + 1 + 1\n");
     printf("1 + 2\n");
     printf("2 + 1\n");
     printf("3\n");
   }

   if (n == 4)
   {
     printf("1 + 1 + 1 + 1\n");
     printf("1 + 1 + 2\n");
     printf("1 + 2 + 1\n");
     printf("1 + 3\n");
     ...
   }

This solution is not general and you will receive zero.

===========================================================

Please read and understand all files given to you, including

pa04.h
pa04.c
answer04.c

To find more make commands, type

make help

To test your program, type 

make testall


You do not need to understand makefile.


