Writing multiple if-else statements in C++ and branching using the rand() function
<p>The question reads:</p>

<blockquote>
  <p>We would like to be able to classify new animals they are discovered in the wild. We will use the <code>rand()</code> function to generate random integers (0 or 1) to represent the No or Yes
  answers respectively to a series of questions. We can then use the answers to classify animals as either:</p>
  
  <ul>
  <li>Insects</li>
  <li>Reptiles</li>
  <li>Birds</li>
  <li>Mammals</li>
  </ul>
  
  <p>In each case, the questions continue until an identification is made. For each question asked, a random value is needed for the answer. To identify each animal, use a nested <code>if</code>-<code>else</code> structure.</p>
</blockquote>

<p>Here are a few sample program runs with their outputs. Each example is a distinct program run. </p>

<pre>
Random Animal Generator

Is the animal a vertibrate? Yes – Not Insect
Is the animal warm-blooded? Yes – Not Reptile
Can the animal fly? Yes – The animal is a Bird!
</pre>

<hr>

<pre>
Random Animal Generator

Is the animal a vertibrate? No – The animal is an Insect!
</pre>

<hr>

<pre>
Random Animal Generator

Is the animal a vertibrate? Yes – Not Insect
Is the animal warm-blooded? No – The animal is a Reptile!
</pre>

<p>I’m so confused. How do I generate all the <code>else if</code> statements to work and answer in order? How do I make them answer by yes or no, then make them answer again yes or no, etc.? Also how do I make them come out randomly with the <code>rand()</code> function?</p>

<p>Code:</p>

<pre><code>#include &lt;iostream&gt; 
using namespace std; 

main () { 
    char Answer; 
    cout&lt;&lt;" Random Animal Generator\n"; 
    cout &lt;&lt; "Is the animal a vertibrate?(1=Yes/0=No)? "; 
    cin &gt;&gt; Answer; 

    if(Answer == '1') 
        cout &lt;&lt; "Not Insect \n"; 
    else (Answer== '0') 
        cout&lt;&lt;"The animal is an Insect!\n"; 

    cout&lt;&lt;endl; 
    system("pause"); 
}
</code></pre>
