I have an assignment in my C++ course where I need to get a user defined amount of integers and the integers themselves are user defined and I need to get their sum. How do I go about doing this?
1) Ask the user how many integers he/she wants
2) Dynamically Allocate an int array of this size
3) Create a loop that asks the user what integers he/she wants to add
4) Create an integer and loop through the array adding the values in the array to it
5) Output the total
declare vars
prompt user to enter desired amount of integers
read into variable
create an array of ints with the size of a variable
loop through each elements asking for input
add all elements together for a sum
display sum
oh, i read the problem wrong. i was under the impression the input would need to be stored in a data type. Listen to cire, but if you're looking for a more complex and inefficient way, keep on following my other post.