function call doesn't work and vector access data
<p>So i want to do inventory program that uses a vector of class items in it. So far my code looks something like this:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;string&gt;
using namespace std;
class Item{
private:
  string month;
  string name;
  float volume;
  float sales;
public:
  void print();
  void print2();
  void sale();
  void report();
  void getdata();
  void setname (string itemname){name=itemname;}
  void setID(int setID){ID=setID;}
};
void Item::print(){
  cout&lt;&lt;"Name    : "&lt;&lt;name&lt;&lt;endl;
  cout&lt;&lt;"ID      : "&lt;&lt;ID&lt;&lt;endl;
}
void Item::print2(){
  vector&lt;Item&gt;*::iterator i;
    for (i=list.begin(); i !=list.end(); ++i){
      i-&gt;print();
  }
/*void Item::sale(){
  vector&lt;Item&gt; }

void Item::report(){
}*/
void Item::getdata(){
  vector&lt;Item&gt; items;
  string name;
  int ID;
  Item *a;
  for (int n=0; n&lt;2; n++){
    cout&lt;&lt;"Enter name:"&lt;&lt;endl;
    getline(cin, name);
    cout&lt;&lt;"Enter ID: "&lt;&lt;endl;
    cin&gt;&gt;ID;
    a = new Item;
    a-&gt;setname(name);
    a-&gt;setID(ID);
    items.push_back(*a);
    cin.get();
  }
}

int main(){
  cout&lt;&lt;"0. Exit \n1. Item Sale \n2. Daily Report \n3. Weekly Check \n4. Monthly Update \n5. Load Inventory File \n6. S\
ort file by Key \n7. Save inventory to a file \n8. Add a New Item \n9. Edit an Item \n10. Delete an item\n";
  int x;
  cin&gt;&gt;x;
  switch(x){
  case 0:
    exit(0);
    break;
  case 1:
    sale();
    break;
  case 2:
    break;
  case 8:
    getdata();
    break;
  default:
    cout&lt;&lt;"Wrong choice!\n";
    break;
  }
</code></pre>

<p>the program doesn't compile because <code>getdata()</code> in case 8 doesn't call the function, why is that? Another question is so if i have stored data in getdata() function how can i use that data vector data in other function by dereferencing?</p>
