12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Step 16Read the command line (data from user)Go to the comment Step 16 in Dietlesson.cs, and add the following lines to read the dataentered by the user at the command line.for (int i = 0; i < args.Length; i++) {if ( args[i].ToCharArray()[0] == '-') {switch (args[i].ToCharArray()[1]) {case 'c':byColumn = true;break;case 'i':varType = NumVarType.Int;break;default:Usage();return;}}else {filename = args[i];break;}}Data data = new Data(filename);Step 17Show correct use of command lineGo to the comment Step 17 in Dietlesson.cs, and add the following lines to show theuser how to use the command correctly (in case of inappropriate input from a user).internal static void Usage() {System.Console.WriteLine(" ");System.Console.WriteLine("usage: Diet [options] ");System.Console.WriteLine("options: -c build model by column");System.Console.WriteLine("-i use integer variables");System.Console.WriteLine(" ");}106 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!