Hello
I passed to functions and I have the next exercise.
you are expected to write a program that computes the sum of all the integers in a range specified by the user. In addition to the main function, there should be a function that accepts two parameters that specify a lower and upper bound. It should compute the sum of all the integers between those bounds, inclusive, and display that sum. The main function should prompt the user for the two bounds and call that function passing in those values. It should then allow the user to compute another interval sum or to quit.
A sample dialog for this program looks as follows:
Enter a lower and upper bound: 2 4
Sum = 9
Enter 0 to quit, 1 to continue: 0
I have written this
#include<iostream>
using namespace std;
void sum ( int value, int& count);
int main()
{
int value1, value2,i,sum=0;
cout<<"Enter a lower and upper";
cin>>value1>>value2;
system("pause");
return 0;
}
but I do not know how to determine how many numbers are between the start and the end value.