Почему я получаю код ошибки id return 1 состояние выхода Мне нужно попрактиковаться в вызове функции, но я изо всех сил пытаюсь вызвать 3 функции.Мне нужно понять, как правильно вызвать функцию в этом примере действительно.Нужно ли мне объявить основную функцию?Согласно упражнению, я не думаю, что я делаю.
#include <iostream>
using namespace std;
/**
* Following function prints a message into the console
*/
void say_hello(){
cout << "Hello, World!" << endl;
}
/**
* The following function prints the sum of 2 integer numbers into the console, the numbers are
* passed as parameter
*/
void print_sum(int a, int b){
cout << "Sum is: " << a+b << endl;
}
/**
* The following function calculates the product of 2 integer parameter passed and returs the product to the caller.
*/
int getProduct(int a, int b){
int p = a * b;
return p;
}
void writeYourCode(int first, int second){
// Instruction 1: Please write a statement to call the function say_hello just after this line
say_hello();
// Instruction 2: Please write a statement to call the function print_sum and pass first and second as parameter
print_sum(first, second);
// Instruction 3: Please write a statement to call the function getProduct and pass first and second as parameter,
// catch the return value in an integer variable declared by you.
// Print that integer containing the result into console using cout, there must be a newline at the end.
// You need to print only the result and a new line
int total = getProduct(first,second);
cout << total << endl;
}