title: C++ Address Book
body: <p>I am trying to make it so if userselection = 1, then the user is asked questions  to create their contact for an address book. It saves all of the contact info to a struct and then saves to a .txt file. I am very new to C++. This is what I have so far... I keep getting  <strong>[Error] expected primary-expression before '.' token.</strong> &lt;---- HOW CAN I FIX THIS
  Also, can anyone offer guidance for how to save the struct to a file?
  Thanks.</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  
  
  
  struct person{
           string Name;
           string Address;
           string PhoneNumber;
           string Email;
               };
  
   int main(){
  int userselection = 0;
  
  
  cout &lt;&lt; "What do you want to do? Press 1 to Add Contact -- Press 2 to Search       for Contact"&lt;&lt;endl;
   cin &gt;&gt; userselection;
  
  
  if(userselection == '1');
    person newPerson;
    cout &lt;&lt; "What is your Name?" &lt;&lt; endl;
    cin &gt;&gt; person.Name;
    cout &lt;&lt; "What is your Address?" &lt;&lt; endl;
    cin &gt;&gt; person.Address;
    cout &lt;&lt; "What is your Phone Number?" &lt;&lt; endl;
    cin &gt;&gt; person.PhoneNumber;
    cout &lt;&lt; "What is your Email?" &lt;&lt; endl;
    cin &gt;&gt; person.Email;
  
  
    }
  </code></pre>