|
-
January 10th, 2004, 01:21 AM
#9
One way to go about the solution would be to note the maximum size of an integer. Every time you reach this maximum size, you add one to a counter and start your "total" integer again (well not again, from wherever you got to). When you have worked out the whole factorial, you simply use output it to the screen:
std::cout << (counter*MAX_INT_SIZE)+total << endl;
or use printf (I don't want to make a fool of myself attempting to write it using printf, I never got used to the %s, %d, etc...never know which one to use :P
Anyhow, that would be a simple way of doing it.
ac
[edit] I just realised that that would not be entirely correct in that it assumes that you would get exactly the max int value every time, but it is almost right :P [/edit]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|