also, if there are any simpler versions, please let me know. I am reading the c++ for dummies, and am up to the arrays section, but dont quite understand arrays.
Also, to save me posting another thread, i am trying to create a zorg like program, but i have no idea how to get a user to input y or n or whatever and the program makes a choice based on that. Help?? :(
First, you should rap code in a code block, using[.code][./code] without the dots.
The first thing i noticed is that you dont have break statements in your switch. at the end of each case you need break; or the computer will read all the cases. When the user enters 1 all four math functions are called. Also, you aren't handleing case 0 to terminate.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Of course it is. You initialize value to 0, then on line 102 you are subtracting value from accumulator, or 0. Why wouldn't this give you a negative number?
And for divide you have accumulator initialized to 1, and of type int. So you divide 1 by value and it's going to be a fractional answer. Since the answer is stored in an int it must be a whole value, and the next value less then 1 that's of type int is 0.
thank you :) so how do i set the accumulator to the first value entered then perform the operations 'on-the-fly' then append the result to the accumulator ready for the next value? this would solve both problems