Thread
:
code to add numbers in an array
View Single Post
Sep 29th, 2007, 9:05 AM
#
3
DaWei
Resident Grouch
Join Date: Jun 2005
Posts: 6,453
Rep Power:
10
First of all, pick some small number like 3 or 5 or something, and go through your code, working it out by hand. After you've done that and fixed your code, then ask yourself what happens if the user enters -12 at the first prompt.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner:
Grumpy on C++ Exceptions
DaWei on Pointers
DaWei
View Public Profile
Visit DaWei's homepage!
Find More Posts by DaWei