title: CRUD (Add/View/Edit/Delete/ViewAll Record)
body: <p>I'm having problem with the string input, the program stops running whenever i enter a string and also if possible kindly fix my statements on the records because they don't seem to work well. Also, how do i delete a string? I tried to replace it with 'none' here for a sample. Thank you in advance!</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main(){
  
      //Initializing
      char choice;
      int i, j, record=0, totalrecord;
      int id[record];
      string name[record];
      double price[record];
      bool back=true;
      string none;
  
  
      //Menu
      while(back=true){   
          cout&lt;&lt;"*******************************"&lt;&lt;endl;
          cout&lt;&lt;"[A] Add Record"&lt;&lt;endl;
          cout&lt;&lt;"[V] View Record"&lt;&lt;endl;
          cout&lt;&lt;"[E] Edit Record"&lt;&lt;endl;
          cout&lt;&lt;"[D] Delete Record"&lt;&lt;endl;
          cout&lt;&lt;"[L] View All Record"&lt;&lt;endl;
          cout&lt;&lt;"Enter your choice and press return: "&lt;&lt;endl;
  
          cin &gt;&gt; choice;
  
          switch (choice){
  
              //Add Record
              case 'a':
              case 'A':
              record++;
              cout&lt;&lt;"Input ID: ";
              cin&gt;&gt;id[record];
              cout&lt;&lt;"Input Name: ";
              cin&gt;&gt;name[record];
              cout&lt;&lt;"Input Price: ";
              cin&gt;&gt;price[record];
              break;
  
              //View Record
              case 'v':
              case 'V':
              cout&lt;&lt;"Enter ID you wish to view: ";
              cin&gt;&gt;id[record];
              cout&lt;&lt;"ID       Name        Price"&lt;&lt;endl;
              cout&lt;&lt;id[record]&lt;&lt;"         "&lt;&lt;name[record]&lt;&lt;"      "&lt;&lt;price[record]&lt;&lt;endl;
              break;
  
              //Edit Record
              case 'e':
              case 'E':
              cout &lt;&lt; "Enter ID you wish to edit: ";
              cin&gt;&gt;id[record];
              cout&lt;&lt;"Input NEW name: ";
              cin&gt;&gt;name[record];
              cout&lt;&lt;"Input NEW price: ";
              cin&gt;&gt;price[record];
              break;
  
              //Delete Record
              case 'd':
              case 'D':
              cout &lt;&lt; "Enter ID you wish to delete";
              cin&gt;&gt;id[record];
              id[record]=0;
              name[record]=none;
              price[record]=0;
              break;
  
              //View All Records
              case 'l':
              case 'L':
              cout&lt;&lt;"ID       Name        Price"&lt;&lt;endl;
              for(i=1; i&lt;totalrecord+1; i++){
                  cout&lt;&lt;id[i]&lt;&lt;"      "&lt;&lt;name[i]&lt;&lt;"       "&lt;&lt;price[i]&lt;&lt;endl;
              }
              break;
  
              //Exit Program if invalid input
              default:
              back=false;
              break;
          }
      }
      return 0;
  }
  </code></pre>