int QSadd_cols (QSprob p, int num, int *cmatcnt, int *cmatbeg,
    int *cmatind, double *cmatval, double *obj, double *lower,
    double *upper, const char **names)
/* Assume p is initialized to the problem in the QSload_prob example. */
/* Add variables v and w to obtain the following LP problem.          */
/*       Maximize  3.0x + 2.0y + 4.0z + 5.1v + 1.1w                   */
/*       Subject to                                                   */
/*                 3.1x + 2.3y + 1.4z + 3.5v + 2.1w <= 12.2           */
/*                 5.0x + 1.1y               + 3.0w  = 10.0           */
/*                 x >= 2.0                                           */
/*                 y free                                             */
/*                 1.0 <= z <= 10.0                                   */
/*                 0.0 <= v <= 2.0                                    */
/*                 1.0 <= w <= 2.0                                    */

int rval;
int cmatcnt[2] = { 1, 2 };
int cmatbeg[2] = { 0, 1 };
int cmatind[3] = { 0, 0, 1 };
double cmatval[3] = { 3.5, 2.1, 3.0 };
double obj[2] = { 5.1, 1.1 };
double lower[2] = { 0.0, 1.0 };
double upper[2] = { 2.0, 2.0 };
const char *names[2] = { "v", "w" };

rval = QSadd_cols (p, 2, cmatcnt, cmatbeg, cmatind, cmatval, obj,
                   lower, upper, names);

if (rval) {
    fprintf (stderr, "Add columns failed, error code %d\n", rval);
} else {
    rval = QSwrite_prob (p, "newsmall.lp", "LP");
    if (rval) {
        fprintf (stderr, "Could not write LP, error code %d\n", rval);
    }
}