CEG221: Advanced C Programming for Engineers

 

Requirements for a Program Specification

 

1)      You must outline in English what the goal of your program does

2)      Break down steps into functions – specify inputs and outputs

3)      Outline anything more specific in pseudocode.

 

Example: Computing the Standard Deviation of an array of floating point numbers

 

 

·        We will need a #define value SIZE which is the size of the array

·        We will need a function to ask the user for each element in the array

{

     float array[SIZE] = {0};

 

     // begin function POPULATE

     for each element in array

{

ask the user for a value

add that value to the ith position of the array

     }

     // end function POPULATE

 

     avg = average(array); // need to write this function

 

     double variance = 0;

     for each element in array

{

variance += square(ith elementavg);

     }

 

     output standard deviation = sqrt(variance);

 

     return 0;

}

 

If you want to see the code for this design document, go here.