title: how to make my program run again C++
body: <p>I have given the following question.</p>
  
  <blockquote>
    <p>Write a menu driven program with following options:</p>
    
    <ol>
    <li>Add new value</li>
    <li>Search value</li>
    <li>Modify value</li>
    <li>Print value</li>
    <li>Print sum of all values</li>
    <li>Quit / Terminate</li>
    </ol>
    
    <p>You have to create 5 options as five function. Add another function to show menu options.</p>
  </blockquote>
  
  <p>and here is my code:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  float f[100]={0};
      //1st option
  void AddNewValue(){int input;
  cout&lt;&lt;"Enter a value\n";
  cin&gt;&gt;f[input];
  }
  //2nd option 
  void SearchValue(){int i, search;
      cout&lt;&lt;"Enter a value to search\n";
      cin&gt;&gt;search;
      int match=0;
      for (int i=1;i&lt;=100;i++)
      {if (f[i]==search)
      {match=1;
      break;}
      }
      if (match==1){cout&lt;&lt;"Matched value found\n";
      }
      else {cout&lt;&lt;"No match found\n";}        
  }
  //3rd option
  void ModifyValue(){int input1;
      cout&lt;&lt;"Enter the position at which you want to modify value\n";
      cin&gt;&gt;input1;
      cout&lt;&lt;"Enter a value\n";
      cin&gt;&gt;f[input1-1];
  }
  //4th option
  void PrintValue(){int i;
  for (i=1;i&lt;=100;i++)
      {cout&lt;&lt;f[i]&lt;&lt;' ';}
  }
  //5th option
  void PrintSum(){int i,sum;
      for(i=1;i&lt;=100;i++)
      {sum=f[i]+f[i+1];}
      cout&lt;&lt;"Sum is : "&lt;&lt;sum;
  }
  //starting Function
  void menu(){int x;
      cout&lt;&lt;"Enter an option: \n";
      cout&lt;&lt;"1- Add new value\n2- Search Value\n3- Modify value\n4- Print Value\n5- Print sum of all values\n6- Quit/terminate\n";
      cin&gt;&gt;x;
      if(x==1){
          AddNewValue();
      }
      else if (x==2){
          SearchValue();
      }
      else if(x==3){
          ModifyValue();
      }
      else if(x==4){
          PrintValue();
      }
      else if(x==5){
          PrintSum();
      }
      else{
      }
  }
  int main(){
  
          menu();
  }
  </code></pre>
  
  <p>And I want to make my full program run again and again until the user enter a wrong option.</p>