Help with program

So I have to make a program that allows the user to enter bot positive and negative numbers and the program is suppose to calculate the sum of only the positive values while ignoring the negative values. Also it is to be a sentinel-controlled loop with a number ending the set of values.

Rather than not initialize userInput it might be better to give it some value you know will cause it to enter the loop (like 1 for instance.) An uninitialized variable may have any value, including the value 0 which would lead to the loop never being entered. Worse, it may be entered sometimes and not be entered at other times.

Or, maybe you want to use a loop that is better suited to this situation: