annotate defical-sharp/defical-cli/inputparser.cs @ 1:758381a85d76 default tip

Incorrect printf format.
author Edho Prima Arief <me@myconan.net>
date Mon, 28 Jun 2010 14:52:19 +0700
parents ebed2bd0d300
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
1 using System;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
2
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
3 namespace defical_cli
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
4 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
5 public partial class Program
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
6 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
7 private partial class main
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
8 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
9 private void getInput()
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
10 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
11 int min, def;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
12 if (graphType == "")
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
13 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
14 while (true)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
15 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
16 Console.Write("Available graph type:\n1. Wheel\n2. Fan\n3. Double Fan\nGraph type (default: 1): ");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
17 if (!parseGraphType(Console.ReadKey().KeyChar))
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
18 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
19 Console.Write("\nInvalid graph type.\n");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
20 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
21 else
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
22 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
23 Console.Write("\n");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
24 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
25 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
26 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
27 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
28 if (numVer == -1)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
29 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
30 while (true)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
31 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
32 min = 5; def = 10;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
33 Console.Write("Number of vertices (default: {0}): ", def);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
34 if (!parseNum(Console.ReadLine(), min, def, out this.numVer))
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
35 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
36 Console.Write("Invalid number of vertices.\nPlease enter number with minimum of {0}.", min);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
37 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
38 else
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
39 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
40 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
41 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
42 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
43 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
44 if (numDef == -1)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
45 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
46 while (true)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
47 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
48 min = 0; def = 2;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
49 Console.Write("Number of deficiencies (default: {0}): ", def);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
50 if (!parseNum(Console.ReadLine(), min, def, out this.numDef))
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
51 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
52 Console.Write("Please enter number (or press enter to use default).");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
53 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
54 else
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
55 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
56 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
57 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
58 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
59 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
60 if (algorithm == "")
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
61 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
62 while (true)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
63 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
64 Console.Write("Available algorithm:\n1. Backtrack\nYour choice (default: 1): ");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
65 if (!parseAlgo(Console.ReadKey().KeyChar))
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
66 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
67 Console.Write("\nInvalid algorithm.\n");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
68 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
69 else
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
70 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
71 Console.Write("\n");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
72 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
73 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
74 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
75 Console.Write("\n");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
76 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
77 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
78 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
79 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
80 }