Iteration SCLM

General Problem Solving

     By using iteration most programs can be solved generally instead of on a case by case basis.  Thus this grant program the ability to become flexible and versatile allowing Computer Science significantly more helpful.  Take the same example for the getting the sum of a set of numbers:

...Pre-Conditions

if(Set.Not_Empty())       //Checks if numbers are left in the set

Next_Number = Set.Get_Next();//Gets next number in set to Next_Number 

Sum = Sum + Next_Number;  //This step adds the following number to Sum

...Post-Conditions

As we can see this code will now work for any size set, thus we can solve the general problem without making adjustments to code for different length sets.


PreviousNext

Previous Table of Contents Next