Look at the following code and identify what is wrong with it:
void multiply(int, int);
int main() {
std::cout << "The answer is: " << multiply(num1, num2);
}
void multiply(int a, int b) {
return a * b;
}
Prototype is missing variable names.
Int parameters should be doubles.
Void functions cannot return a value.
Value-returning functions must be called in a statement that stores the returned value in a variable.
Void functions cannot return a value.
#include <iostream>
int multiply(int, int);
int main() {
int num1=3, num2=5;
std::cout << "The answer is: " << multiply(num1, num2);
}
int multiply(int a, int b) {
return a * b;
}
Comments
Leave a comment