Section 8c

Step Two, Reviewed


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Systematic and Structured Programming, Part 2

Step Two - Expanding the Solution


As you found before, your step one action was pretty easy, and you have accomplished an important thing. Now that you have the overall flow of the program fleshed out, almost all of the remaining programming work will involve "filling in the blanks" in a kind of ever-expanding strategy that includes both a top-down and an iterative refinement process.

If you are working through this with the web page, you should create a new QuadProg_StepTwo.c and copy your QuadProg_StepOne.c work into it now so that you don't overwrite your first step.

Consider the following items from the previous step:

Initialize the program

// initialize program

// initialize variables

// show title

Get the coefficients from the user

// get coefficients from user

// get coefficient A

// get coefficient B

// get coefficient C

Process the quadratic roots

 

Quadratic Equation

// process the quadratic roots

// calculate the discriminant

// calculate the discriminant square root

// calculate the denominator

// calculate roots

// calculate root one

// calculate root two

Display the Roots

// display roots

// display user input values

// display root one

// display root two

End the program

// end program

// display program end

// return success to the operating system
return 0;

The Whole Schlemiel

int main()
{
// initialize program

// initialize variables

// show title

// get coefficients from user

// get coefficient A

// get coefficient B

// get coefficient C

// process the quadratic roots

// calculate the discriminant

// calculate the discriminant square root

// calculate the denominator

// calculate roots

// calculate root one

// calculate root two

// display roots

// display user input values

// display root one

// display root two

// end program

// display program end

// return success to the operating system
return 0;
}

This again does not take very long to write, but you have expanded what the main part of your program will do now. You have prepared yourself for the next part of the programming process, which is to break the problem down into manageable problem-solving components.

Some notes:


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