![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
|
Controlling Number Of Dots With Modulo
Hullo,
I'm trying to reduce the number of dots being printed to the screen, here's the code I attempted at trying: else {
dots++;
dots %= 10;
if ( dots = 0 ) {
cout << "...\n"; // If "hsr" isn't an integer, output "..." to the screen
}
}It increments dots, peforms a modulo operator, and if it's dividable (sp?) by 10, it prints the dots, but I tried this and it doesn't seem to work (it doesn't print ANYTHING now). I was wondering what I was doing wrong and how to put it right. Thanks, Haz. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
A common error.
if ( dots = 0 ) // WRONG if (dots == 0 ) // RIGHT I think you can spot the error. ![]() |
|
|
|
|
|
#3 |
|
Programmer
|
Ah, damn, I knew it was something simple, thanks
![]() |
|
|
|
|
|
#4 | |
|
SEXY SHOELESS GOD OF WAR!
![]() Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,183
Rep Power: 5
![]() |
Quote:
if(0 = dots)
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|