Squashed bug causing incorrect digits. Now fully working
I totally brainfarted and put this->preDigits.size() in the for loop comparison clause, which gets re-evaluated every loop. So it was leaving digits on the stack that should have been printed, causing errors both immediately and down the line.
This commit is contained in:
parent
aac5409a72
commit
218d5b7da8
5 changed files with 70 additions and 27 deletions
14
main.cpp
14
main.cpp
|
@ -1,9 +1,17 @@
|
|||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include "Spigot.hpp"
|
||||
|
||||
int main(void) {
|
||||
Spigot *piSpigot = new Spigot(1000);
|
||||
for(int i = 0; i < 1000; i++) {
|
||||
int main(int argc, char **argv) {
|
||||
int numDigits = 0;
|
||||
if(argc < 2) {
|
||||
std::cout << "Usage: spigot <numDigits>" << std::endl;
|
||||
return -1;
|
||||
} else {
|
||||
numDigits = std::atoi((const char *)argv[1]);
|
||||
}
|
||||
Spigot *piSpigot = new Spigot(numDigits);
|
||||
for(int i = 0; i < numDigits; i++) {
|
||||
piSpigot->pump();
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue