Loops

I have an idea of where to start, but can someone help me figure out my errors?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  #include <iostream>

using namespace std;

float loopCalculateSum(float sum,float userInput);
void showResults();

int main()


{
	//Inititalize variable
	float sum = 0;
	float userInput = 0;

	// Call to loop function
	sum = loopCalculateSum(sum,userInput);

	//Delay
	char quitKey;
	cout << "Press any key and Enter to end program: ";
	cin >> quitKey;

	//End of Program
	return 0;
}


// Loop function

float loopCalculateSum(float sum, float userInput)

{
	float userInput;
	do {
		cout << "Enter a postive number";
		cin >> userInput;

		sum = sum + userInput;
		cin >> sum;


	} while (userInput >= 0);
}
closed account (48T7M4Gy)
delete line 34 because you can't "re-declare" userInput
Anything else? That i need to fix?
closed account (48T7M4Gy)
Anything else? That i need to fix?

Pardon?
Topic archived. No new replies allowed.