I have to:
Creates an array of 5 that will accept the names of five animals
Creates an array of 5 that will store a list of five animal ages
Accept the names and ages of one to five animals.
stopping at either 5 or when the person enters the word STOP, stop or Stop.
Displays the following (5 points)
a. name of the Program author and the Authors major
b. Displays a blank line
c. Displays a list of animals and their ages.
This is what I have so far. It's not displaying the names and age and crashes.
cout << animal[NAME]; is wrong.
name is 5, and your array is 0-4 (5 total)
and logically, besides that (that is the crash reason) it should be
cout << animal[j];
Thank you for your response jonnin. So I corrected everything and it works perfectly now. However, I'm not sure how to add in the stop part. "Accept the names and ages of one to five animals.
stopping at either 5 or when the person enters the word STOP, stop or Stop."
In the directions it says:
Create a Vector that will accept the names of five animals
Create a Vector that will store a list of five animal ages
Accept the names and ages of one to five animals. (5 points)
stopping at either 5 or when the person enters the word STOP, stop or Stop. You MUST use push_back when adding items to the vector.
Mantorr22: you're checking for STOP/stop/Stop after this entry has already been pushed back into names. Perhaps you meant to be doing this before push_back or, pop_back names if STOP/stop/Stop though this is more drawn out?