| TheLoneWolf wrote: |
|---|
| Please explain the 'x' bit to me. I was planning on creating an endless do loop there. |
Do what I suggested and you still have an endless loop that will print out an increasing value for x.
Do you really want that?
If I were to create an endless loop I use a
while(true) loop instead of a
do...while loop. Example:
1 2 3 4
|
while(true)
{
// do something ridiculously stupid endlessly
}
|
Personal suggestions:
I don't like obscure variable names, like x. What does x represent? Why not use a descriptive and self-documenting name, such as (for example)
creatureHitPoints?
The only time I use one character variable names is in a small for loop, and for readability I consider still using a descriptive name. The time "wasted" typing long variable names makes for much less time doing code reviews.
About readability, PLEASE learn to use whitespace. Your code is far too dense/compact to make debugging easy. It is a real nightmare to look at.
I quite emphatically suggest to never use
using namespace std;. Get in the habit of specifying the namespace explicitly.
std::cout, not
cout.
When you start using 3rd party libraries, such as Boost, being lazy with
using namespace std; can and will make finding compile-time errors a real pain.
If you use certain std library objects/functions a lot,
std::cout for example, then consider
using std::cout; as a better alternative to
using namespace std;.