zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
-- -- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --
--- --- ---
| | | |
| | | |
| | | |
--- --- ---
| | |
| | |
| | |
--- --- ---
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
- - - -
| | | | |
- - -
| | | | |
- - -
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
-- -- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --
--- --- ---
| | | |
| | | |
| | | |
--- --- ---
| | |
| | |
| | |
--- --- ---
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
- - - -
| | | | |
- - -
| | | | |
- - -
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
-- -- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --
--- --- ---
| | | |
| | | |
| | | |
--- --- ---
| | |
| | |
| | |
--- --- ---
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
- - - -
| | | | |
- - -
| | | | |
- - -
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
-- -- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --
--- --- ---
| | | |
| | | |
| | | |
--- --- ---
| | |
| | |
| | |
--- --- ---
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
- - - -
| | | | |
- - -
| | | | |
- - -
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
-- -- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --
--- --- ---
| | | |
| | | |
| | | |
--- --- ---
| | |
| | |
| | |
--- --- ---
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
- - - -
| | | | |
- - -
| | | | |
- - -
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
-- -- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --
--- --- ---
| | | |
| | | |
| | | |
--- --- ---
| | |
| | |
| | |
--- --- ---
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
- - - -
| | | | |
- - -
| | | | |
- - -
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
-- -- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --
--- --- ---
| | | |
| | | |
| | | |
--- --- ---
| | |
| | |
| | |
--- --- ---
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
- - - -
| | | | |
- - -
| | | | |
- - -
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
-- -- -- --
| | | | | |
| | | | | |
-- -- -- --
| | | | |
| | | | |
-- -- -- --
--- --- ---
| | | |
| | | |
| | | |
--- --- ---
| | |
| | |
| | |
--- --- ---
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
| | |
| | |
| | |
| | |
| | |
----- -----
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
--------- --------- ---------
- - - -
| | | | |
- - -
| | | | |
- - -
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$ bin/Debug/LCNumbers testfile
Exception thrown in NumberFactory: DigException
zekedragon@zeke-comp:~/Projects/C++/LCNumbers$
So... what the heck? Why is it randomly just "deciding" to throw an exception it should never get in the first place (the code is below)? I thought computer programming was a deterministic process. Do any of you know how? Digit* NumberFactory::makeDigit(int dig) throw(std::bad_alloc)
{
try
{
switch (dig)
{
case 0:
return new Zero();
case 1:
return new One();
case 2:
return new Two();
case 3:
return new Three();
case 4:
return new Four();
case 5:
return new Five();
case 6:
return new Six();
case 7:
return new Seven();
case 8:
return new Eight();
case 9:
return new Nine();
default:
throw DigException();
return NULL;
}
}
catch (DigException& e)
{
std::cout << "Exception thrown in NumberFactory: " << e.what() << std::endl;
exit(EXIT_FAILURE);
}
}
////////////////////////////////////////STARTER.CPP////////////////////////////////
void Starter::run() throw(std::bad_alloc)
{
std::auto_ptr< std::vector< Digit* > > digVect(new std::vector< Digit* >);
for (unsigned int iii = 0; iii < numberSet.size(); ++iii)
{
digVect->push_back(numFact.makeDigit(numberSet.at(iii)));
}
std::auto_ptr< std::string > theString = prs.parse(digVect, size);
std::cout << *theString << std::endl;
}
Starter::run() is the only place in the program that calls NumberFactory::makeDigit, so the natural question is where the numberSet vector gets it's numbers. Well, there are actually two different sources, but they're almost precisely the same, the difference being dependent wholly on whether the user is issuing a command-line argument version or a cin version: int anum = getLength(argv[2]);
// You can safely assume getLength always returns the correct length.
for (int iii = 0; iii < anum; ++iii)
{
char* temp = new char(argv[2][iii]);
numberSet.push_back(atoi( (const char*) temp) );
delete temp;
}
So I think that may be the source of all my pain, but who knows. Anyway, I'd love to hear any ideas, and if I'm doing everything terribly or not. Alright, I'm getting some sleep. :P


Sign In
Create Account

Back to top










