### Array Problem

Hello,
I have been scouring the forums and have not found a solution to my problem. OK here it is. I am a beginner about 5 weeks into first term Programming Logic and Design class where we use flowcharts and psudocode as the way my school teaches the basics of programming. Anyway I am trying to code our final project for fun.

I am making an Animal guessing game that only has one animal to guess. The problem I am having is getting my program to step to the next segment in my array. All that my loop does is repeat the first question over and over and it doesn't step to the next question in the array. I am just looking for a point in the right direction so I can get this figured out and finish this program.

Here is the code I have so far.

 ``1234567891011121314151617181920212223242526272829303132333435363738`` ``````#include #include using namespace std; int main() { string animalGuess; string animalAnswer = "Aardvark"; string animalQuestions [5]; animalQuestions [0] = "The animal I am thinking of has fur. What is it?"; animalQuestions [1] = "The animal I am thinking of eats ants. What is it?"; animalQuestions [2] = "The animal I am thinking of lives in Africa. What is it?"; animalQuestions [3] = "The animal I am thinking of has sharp claws. What is it?"; animalQuestions [4] = "The animal I am thinking of has a long tounge. What is it?"; cout << "Welcome to a simple one animal guessing game." << endl; for (int m = 0; m < 5; ++m) { if (animalGuess != animalAnswer) { cout << animalQuestions [0] << endl; cin >> animalGuess; } } return 0; }``````

Any help will be very appreciated.
Thank You
`animalQuestions [0]`
Same question every time. Perhaps you meant
`animalQuestions [m]`

What is supposed to happen if the user guesses correctly? Is the loop meant to end? It doesn't.
Thank you so much. I have been going over this all weekend. I did not finish the rest of the program because I wanted to get this part working before moving on. Again thank you for you answer. It had helped me greatly.
Topic archived. No new replies allowed.