I'm working on a science experiment to see which is faster: Java, or C++.
I've been working on the code for the experiments but in one experiment where I'm seeing which can do the fastest math calculation, they both end up with different answers to the same problem. Here's the code:
If you step through with the debugger you will see the java result is correct. The c++ version's result is overrunning. Change addnum and holdernum to long long. You also have a typo on line 19 on the c++ version, holdernum[3].
I am also surprised they dont throw division by zero errors.