title: How can i change the value of an array then display the whole new array?
body: <p>i need help. I have an array of 10, and it consists of a string and a value initialized to it. My question is how i can ask the user to input how much more to add or how much to remove. then display the updated list.
  for example choose valve, then add 2 more, which will make it 12, then display the updated array with the other arrays. i need to pass it through a function also. please and thank you for the help in advance, here it my code so far. Feel free to criticize as much as you guys would like. It will only help me get better :)</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstdlib&gt;
  #include &lt;iomanip&gt;
  #include &lt;cstring&gt;
  #include &lt;string&gt;
  using namespace std;
  //define Structure as invParts
  struct invParts{
  
  string name;
  int qty;
  
  
  };
  
  
  void addparts(invParts *&amp;c,int);
  void removeparts(invParts *&amp;c, int);
  
  
  
  
  int main()
  {
  invParts *descrip;
  int row = 0;
  char choice;
  
  
  invParts bin[10]= { {"valve",10}, {"Bearing",5}, {"Bushing",21},
                       {"Coupling",7}, {"Flange",5}, {"Gear",5}, 
                       {"Gear House", 5}, {"Vacuum         Gripper", 25}, 
                       {"Cable",18}, {"Rod",12}, };
  
  
  
  cout&lt;&lt;"-----------------------------------------------------" &lt;&lt; endl;
  cout&lt;&lt;"Part Description" &lt;&lt; "      " &lt;&lt; "Number of parts in the bin" &lt;&lt; endl;
  cout &lt;&lt;"----------------------------------------------------" &lt;&lt; endl;
  cout &lt;&lt; endl;
  for(row = 0; row &lt; 10; row++)
  {
      cout &lt;&lt; setw(11)&lt;&lt; left &lt;&lt;bin[row].name &lt;&lt; setw(25) &lt;&lt; right &lt;&lt; bin[row].qty&lt;&lt; endl;
  
  
  
  }
  cout &lt;&lt; endl;
  cout &lt;&lt; "Here are 3 options" &lt;&lt; endl;
  cout &lt;&lt; "Type A , to Add parts" &lt;&lt; endl;
  cout &lt;&lt; "Type R , to Remove parts" &lt;&lt; endl;
  cout &lt;&lt; "Type E, to Exit Program" &lt;&lt; endl;
  cout &lt;&lt; "Choose your option: "; 
  cin &gt;&gt; choice;
  cout &lt;&lt; endl;
  switch (choice)
  {
  int num;
  case 'A' :
  case 'a' :  cout &lt;&lt;"You will now add" &lt;&lt; endl;
              addparts(descrip,num);
              break;
  
  case 'R':
  case 'r': cout &lt;&lt;"You will now remove" &lt;&lt; endl;
            //removeparts(descrip,num);
  
               break;
  case 'E':
  case 'e': cout&lt;&lt;"Now exiting program" &lt;&lt; endl;
              exit(0);
  
  
  
  
  }
  
  
  
  
  
  
  system("pause");
  return 0;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>void addparts(invParts *&amp;c,int number)
  {
      string what;
      int n;
  
  
      cout &lt;&lt;"Which part? " &lt;&lt; endl;
      cin &gt;&gt; what;
  
  
           //am i doing this right?
  
      if ( what == "valve" || what == "Valve")
          cout &lt;&lt;"How much do you want to add? "&lt;&lt;endl;
          cin &gt;&gt; n;
  
  
  
  }
  /*void removeparts(invParts *&amp;c, int)
  {
  
  //you guys can show me how to do the add, i can do the remove
  
  
  }
  */
  </code></pre>