converting command line arguments program to menu driven program
<p>I did a program that took command line arguements to run it. I am now trying to do a menu drive program as part of its "improvement." I used,</p>

<pre><code>int main(int argc, char * argv[])
</code></pre>

<p>in the original where the arguements were:</p>

<pre><code>char * startCity = argv[1];
char * endCity = argv[2];
in.open(argv[3],ios::in); //&lt;----file name went here
</code></pre>

<p>Here is what I did now and I know it is incorrect:</p>

<pre><code>int main(int argc, char * argv[]){

int menuChoice;
string startCity;
string endCity;
string fileName;
ifstream in;

cout&lt;&lt;"Welcome to J.A.C. P2\n"
  "\n"
  "This program will find the shortest path\n"
  "from One city to all other cities if there\n"
  "is a connecting node, find the shortest path\n"
  "between two cities or find the shortest\n"
  "between three or more cities.\n"&lt;&lt;endl;

cout&lt;&lt;"Please make a choice of what you would like to do:\n"&lt;&lt;endl;

cout&lt;&lt;"  1------&gt; Shortest Path between 2 cities.\n"
      "  2------&gt; Shortest Path between 3 or more cities.\n"
      "  3------&gt; Shortest Path from 1 city to all.\n"
      "  9------&gt; Take your ball and go home!\n"&lt;&lt;endl;
cout&lt;&lt;"Waiting on you: "; cin&gt;&gt;menuChoice;

switch (menuChoice) {
    case 1:
        cout&lt;&lt;"Enter the starting city: ";
        cin&gt;&gt;StartCity;
        cout&lt;&lt;"\nEnter the ending city: ";
        cin&gt;&gt;EndCity;
        cout&lt;&lt;"\nEnter the name of the file: ";
        cin&gt;&gt; fileName;

    break;
</code></pre>

<p>Since all of my program is based on char * argv[] How can I convert those into strings OR how can I assign variables to the arguements in order to read them in?</p>

<p>I appreciate all the answers but they seem to be going in the direction I am trying to get away from. The OLD program used command line arguements. How can I do this:</p>

<pre><code>string StartCity = char * argv[1];
string EndCity = char * agrv[2];
string filename = in.open(argv[3],ios::in);
</code></pre>

<p>That is what I am trying to do. I am sorry if I did not make myself clear.</p>
