Listing 2 Main loop of the LP program

main(int argc, char **argv)
{

      int i,j;                /* loop control */
      char temp[10];          /* workspace */

      /* build the initial tableau */
      build_basis();
      printf ("**** ORIGINAL TABLE\n");
      print_table();
      pass = 1;

      /* select_entering will return a 0 when
       there are no more entering VARIABLES,
       otherwise, the location of the entering
       variable is returned */
      while (enter_pos = select_entering()) {

         /* return pos for leaving variable */
         leave_pos = select_leaving();

         /* calculate the pivot element */
         pivot_element = table[leave_pos][enter_pos];

         /* calculate the new pivot equation */
         new_pivot();

         /* calculate all the non-pivot EQUATIONS */
         new_equation();

         /* label the new basis */
         strcpy (basis[leave_pos],
                objective[enter_pos]);

         printf ("\n**** ITERATION %d\n\n", pass);
         pass++;

         print_table();

      }

}
/* End of File */