If Problem

• 01-26-2009
Nathan the noob
If Problem
Code:

```if(input == "LOL")     {             random = (rand() % ( 1 - 6 )) + 1;                         if( random == 1)             {             cout <<"You Stumble along the dirt road and find a penny\n";             money = money + 1;               if(counter >= 1)               {               counter = counter - 1;               }             }             if( random == 2)             {             cout <<"You reach into yer moms pocket and pull out a penny\n";             money = money + 1;               if(counter >= 1)               {               counter = counter - 1;               }             }             if(random == 3)             {             cout <<"As you search your couch you find a penny\n";             money = money + 1;               if(counter >= 1)               {               counter = counter - 1;               }             }             if(random == 4 && counter == 0)             {             cout <<"As you wander helplessly down the street you get knocked in the head.\n"                   <<"You wake up later to find yourself in a alley and yer pockets empty\n";             money = 0;             counter = 5;             }             if(random == 5)             {             cout <<"You ask the mayor for bebe mooneys he gives u a penny\n";             money = money + 1;               if(counter >= 1)               {               counter = counter - 1;               }             }             if(random == 6)             {             cout <<"You Beg for mooneys and recieve a penny for a hard days work\n";             money = money + 1;               if(counter >= 1)               {               counter = counter - 1;               }             }                             }```
For some strange reason when typing this it will some times not say any thing but it never says number 6 and im not sure why btw this is a snippet of the code not all
• 01-26-2009
tabstop
The possible values of the % are 0, 1, 2, 3, and 4. Adding one gives 1, 2, 3, 4, and 5. So not getting 6 is exactly what you should expect.
• 01-26-2009
Nathan the noob
I figured it out :P