Solved

I can only see 5 words in my list..

Posted on 2007-12-01
2
192 Views
Last Modified: 2010-04-21
I can only see 5 words in my list file. Is there something wrong with the code?

void Game::listWords()
{
      Game myGame;
      myGame.loadFile();

      cout << "\tThe following words in the file are: \n" << endl;

      for(int Loop = 0; Loop < Count - 1; Loop++)
      {
            cout << "\t" << Words[Loop] << "\n";
            if (++Loop > Count)
                  break;
            cout << "\t" << Words[Loop] << "\n";
            if (++Loop > Count)
                  break;
            cout << "\t" << Words[Loop] << "\n";
            if (++Loop > Count)
                  break;
            cout << "\t" << Words[Loop] << "\n";
            if (++Loop > Count)
                  break;
            cout << "\t" << Words[Loop] << "\n";
      }
}

0
Comment
Question by:jschmuff
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 20389315
If you initialize 'Count' to 0, that should be

      for(int Loop = 0; Loop < Count; Loop++)
         cout << "\t" << Words[Loop] << "\n";

That is all you need.
0
 

Author Closing Comment

by:jschmuff
ID: 31412135
perfect answer you are awesome.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question