Currently trying to learn about functions and parameters and I wrote this little program that asks for two numbers and adds them. However when I build it says "|13|error: 'sum' was not declared in this scope|", could someone please tell me where I've gone wrong? Thanks.
#include <iostream>
usingnamespace std;
double sumNumbers(double a, double b)
{
double sum = a + b;
return sum;
}
void printResult(double a, double b)
{
cout << "You're answer is " << sum (a, b) << endl;
}
int main()
{
cout << "Enter two numbers to be added" << endl;
double a, b;
cin >> a >> b;
printResult (a, b);
return 0;
}