Sum of a RANGE of numbers.
This WSQ was a little bit more difficult, than the ones before. I got inspiration from a friend’s code but I didn’t liked so I change some parts of his code.
First I would like you to see my code. I tried used a function and a condition while to make the program sum all the integers between the two given numbers. I confess there is a problem when the user types consecutive numbers but I don’t know how to fix it. (Also when using negative numbers…)
Nevertheless I feel proud of my “adding machine”! First this, and later I will conquer the world with my software development abilities!
Code:
I used this web page to figure out how to order the numbers:
http://codereview.stackexchange.com/questions/64758/sort-three-input-values-by-order
I also recommend this web page to understand the functions:
http://www.cplusplus.com/doc/tutorial/functions/
This time no one helped me (besides reading Eduardo’s code).
P.S.: I promise to use GitHub next partial, and I will update my posts with a GitHub link. Thank you for your patience.
WSQ07 by Octavio Rojas is licensed under a Creative Commons Attribution 4.0 International License.