I'm at a loss, I can't for the life of me understand what this question is asking, and my assumption was that it wanted a series of numbers input and a function to keep a running total. My head is a bit in the clouds today so this might just be me making a stupid mistake, the question is as follows:
"Using a static integer variable, sum, in a function called AddUp(), keep a running total of values passed by repeated calls to the function. After each call to the function, add the value passed in to sum and return and display sum in main()."
And so far I'm staring at something that I'm aware doesn't make sense, but I don't know what to do
#include <iostream> //allows program to input and output data
#include <iomanip>
usingnamespace std;
int value;
int result;
int main () //Begins program execution
{
int value;
int result;
result = 0;
cout << "Enter value or -1 to quit: ";
cin >> value;
cin >> value;
while(value != 0)
{
result = AddUp(value);
cout << result;
cin >> value;
}
system ("pause");
return 0;
}
function addup()
{
cin >> value;
value + result = result;
}