Thanks for the help guys, I was able to have main call a few separate functions, I was missing the curly braces for the loop to get the Sum.
Cheers!
Code:
#include <iostream>
using namespace std;
/**********************************************************************
* getMultiple prompts the user for the multiple they want.
************************************************************************/
int getMultiple()
{
cout << "What multiples are we adding? ";
int number;
cin >> number;
return number;
}
/**********************************************************************
* addMultiples initiates a loop for the multiple and sums the data.
************************************************************************/
int addMultiples(int multiple)
{
int sum = 0;
int end = 100;
for (int count = multiple; count < 100; count += multiple)
{
sum += count;
}
return sum;
}
/**********************************************************************
* Display outputs the sum of the multiples to the user.
************************************************************************/
void display(int multiple, int sum)
{
cout << "The sum of multiples of "
<< multiple
<< " less than 100 are: "
<< sum
<< endl;
return;
}
/**********************************************************************
* Main calls the other functions in the program
************************************************************************/
int main()
{
int multiple = getMultiple();
int sum = addMultiples(multiple);
display(multiple, sum);
return 0;
}