title: How do I replace the go to statement?
body: <p>I'm rather new to coding and right now I am working on a assignment where the user is given three options. 
  1. Add data
  2. View data
  3. Quit
  My code now includes both switch statement and goto statement and from what I understand this is bad practice. So my question is, how can I replace there and with what? 
  Some of this code is in swedish but the options is as stated above. 
  Any help appriciated. </p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;cstdlib&gt;
  #include &lt;string&gt;
  using namespace std;
  int choice;
  int c=0;
  double percentage[100];
  int menyVal() //Funktion som skriver ut meny
  {
      cout&lt;&lt;"V\x84nligen v\x84lj ett av f\x94ljande alternativ f\x94r att forts\x84tta."&lt;&lt;endl;
      cout&lt;&lt;"1 L\x84gg till kandidat och antal r\x94ster."&lt;&lt;endl;
      cout&lt;&lt;"2 Se insamlad data."&lt;&lt;endl;
      cout&lt;&lt;"3 Avsluta."&lt;&lt;endl;
      cin&gt;&gt;choice;
      return choice;
  
  }
  class Products
  {
  public:
      string name;
      int vote;
      Products();
  
  };
  Products::Products()
  {
      string name = "";
      int vote = 0;
  }
  int main()
  {
      Products arr[100];
      cout&lt;&lt;"V\x84lkommen till valr\x84kning."&lt;&lt;endl&lt;&lt;endl;
      begin:
      menyVal();
  
  
      switch (choice)
      {
          case 1:
              cout&lt;&lt;"Du har valt att l\x84gga till r\x94st-data."&lt;&lt;endl&lt;&lt;endl;
          for(int i = (1+c) ; i &lt;= 100 ; i++)
           {
               if(i&gt;100)
               {
                   cout&lt;&lt;"Du har n\x86tt max antal i index."&lt;&lt;endl;
               }
  
               else
               {
  
                    cout&lt;&lt;"Skriv in namnet p\x86 kandidat nr"&lt;&lt;i&lt;&lt;"."&lt;&lt;endl;
                    cin&gt;&gt;arr[i].name;
                    if(arr[i].name==arr[i-1].name)
                    {
                      cout&lt;&lt;"Kandidater kan inte heta exakt samma sak."&lt;&lt;endl;
                    }
                    else
                    {
                    cout&lt;&lt;"Skriv in antal r\x94ster "&lt;&lt;arr[i].name&lt;&lt;" fick."&lt;&lt;endl;
                    cin&gt;&gt;arr[i].vote;
                    cout&lt;&lt;"Datan \x84r nu inlagd i index."&lt;&lt;endl&lt;&lt;endl;
                    c++;
  
                    }
                    goto begin;
                    }
               }
          break;
  
          case 2:
  
              cout&lt;&lt;"Du har valt att se all inmatad data."&lt;&lt;endl&lt;&lt;endl;
              if(c==0)
                  {
                      cout&lt;&lt;"Index \x84r just nu tomt."&lt;&lt;endl&lt;&lt;endl;
                      goto begin;
                  }
                  else
                  {
                      cout&lt;&lt;"|Kandidat Nr|"&lt;&lt;"\t"&lt;&lt;"|Namn|"&lt;&lt;"\t"&lt;&lt;"|Antal r\x94ster.|"&lt;&lt;"\t"&lt;&lt;"|R\x94ster i %.|"&lt;&lt;endl;
                      for(int i =1 ; i &lt;=c ; i++)
                  {
                      cout&lt;&lt;i&lt;&lt;"\t\t";
                      cout&lt;&lt;arr[i].name&lt;&lt;"\t\t";
                      cout&lt;&lt;arr[i].vote&lt;&lt;"\t\t";
                      cout&lt;&lt;arr[i].vote&lt;&lt;"%"&lt;&lt;endl;
  
  
                  }
                      goto begin;
                  }
  
          break;
  
          case 3:
  
               cout&lt;&lt;"Du har valt att avsluta programmet."&lt;&lt;endl;
                     return 0;
  
  
  }
  return 0;
  }
  </code></pre>