syntax error in code, do not understand why

```++// Computation.cpp - This program calculates sum, difference, and product of two values.
// Input: Interactive
// Output: Sum, difference, and product of two values.

#include <iostream>
#include <string>
void calculateSum(double, double);
void calculateDifference(double, double);
void calculateProduct(double, double);
using namespace std;

int main()
{
double value1;
double value2;

cout << "Enter first numeric value: ";
cin >> value1;
cout << "Enter second numeric value: ";
cin >> value2;

// Call calculateSum

// Call calculateDifference

// Call calculateProduct

return 0;
} // End of main() function

int CalculateSum (value1, value2)
{
value1 + value2
}


int CalculateProduct (value1, value2)
{
value1 * value2
}


int calculateDifference (value1, value2)
{
value1 - value2
}
```

why does this pull up a syntax error?
First, capitalization: CalculateSum is a different name than calculateSum. Be consistent in your function declaration and definition.

Second, your function declaration is:
void calculateSum(double, double);

but your function definition is:
1
2
3
4
int CalculateSum (value1, value2)
{
    // ...
}

Notice how your return type is 'void' the first time, but 'int' the second time. This is inconsistent.

Most likely, you actually want to return a double.

Third, you need types with your function parameters.

Fourth, you need an actual return statement + semi-colon.

So your function declaration should be:
double calculateSum(double, double);

And your function definition should be:
1
2
3
4
double calculateSum(double value1, double value2)
{
    return value1 + value2;
}


Similar issues with all your calculate* functions.
Last edited on
@ganado
```
// Computation.cpp - This program calculates sum, difference, and product of two values.
// Input: Interactive
// Output: Sum, difference, and product of two values.

#include <iostream>
#include <string>
double calculateSum(double, double);
double calculateDifference(double, double);
double calculateProduct(double, double);
using namespace std;

int main()
{
double value1;
double value2;

cout << "Enter first numeric value: ";
cin >> value1;
cout << "Enter second numeric value: ";
cin >> value2;

// Call calculateSum

// Call calculateDifference

// Call calculateProduct

return 0;
} // End of main() function

double calculateSum (value1, value2)
{
return value1 + value2;
}


double calculateProduct (value1, value2)
{
return value1 * value2;
}

double calculateDifference (value1, value2)
{
return value1 - value2;
}
```

i tried doing this, but it still returns errors.
nevermind, figured it out!
thank you!

completed code:
```
// Computation.cpp - This program calculates sum, difference, and product of two values.
// Input: Interactive
// Output: Sum, difference, and product of two values.

#include <iostream>
#include <string>
double calculateSum(double, double);
double calculateDifference(double, double);
double calculateProduct(double, double);
using namespace std;

int main()
{
double value1;
double value2;

cout << "Enter first numeric value: ";
cin >> value1;
cout << "Enter second numeric value: ";
cin >> value2;

cout << calculateSum(value1,value2);

cout << calculateDifference(value1,value2);

cout << calculateProduct(value1,value2);

return 0;
} // End of main() function

double calculateSum(double value1, double value2)
{
return value1 + value2;
}

double calculateProduct (double value1,double value2)
{
return value1 * value2;
}

double calculateDifference (double value1, double value2)
{
return value1

- value2;
}
```
Topic archived. No new replies allowed.