Section 2e

Step Three


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Systematic and Structured Programming

Step Three - Identifying and Locating the Functions

Once again, step two was not difficult. In fact, between writing steps one and two, you probably still don't have a whole 20 minutes invested in this process. That's just one of the benefits here.

Once again (again), you will also find that step three is just an expansion of step two, although you will be taking some new actions here. Mostly however, you will just be filling in areas that are guided by what you wrote in your previous steps.

If you are working through this with the web page, you must create a new program file named in your Project_1 structure. This program file will be named QuadProg_StepThree. You must then copy the contents of the main function in QuadProg_StepTwo into the main function of your QuadProg_StepThree. At this point, you want to save what was stored as step two for your future review.

Now, you must work your way through the program from top to bottom following the iterative refinement process. This time, you will be identifying the need for, and the use of, functions in your program, but because you are not required to develop your own functions, you will not be creating any new functions in this activity. You will only use those developed by others.

Start here (iteratively)

Initialize the program

   // initialize program

// initialize variables

// show title
   // initialize program

// initialize variables

// show title
// function: printf
      // Header Files
#include <stdio.h>

Get the coefficients from the user

   // get coefficients from user

// get coefficient A

// get coefficient B

// get coefficient C
   // get coefficients from user

// get coefficient A
// function: printf, scanf

// get coefficient B
// function: printf, scanf

// get coefficient C
// function: printf, scanf

Process the quadratic roots

   // Process the quadratic roots

// calculate the discriminant
// calculate the square root of the discriminant

// calculate the denominator

// calculate roots

// calculate root one // calculate root two
   // Process the quadratic roots

// calculate the discriminant

// calculate the square root of the discriminant
// function: sqrt

// calculate the denominator

// calculate roots

// calculate root one // calculate root two
    // Header Files
#include <stdio.h>
#include <stdio.h>
#include <math.h>

Display the roots

   // display roots

// display user input

// display root one

// display root two
   // display roots

// display user input
// function: printf

// display root one
// function: printf

// display root two
// function: printf

End the program

   // end program

// display program end

// return function success
   // end program

// display program end
// function: printf

// return function success

Completing Step Three

Some more notes:


To see the step three process in action, watch this video; then develop your step three code with or without the video as needed in your own editor.