Complete the code to define a function named greet.
void [1]() { std::cout << "Hello!" << std::endl; }
The function name should be greet as requested.
Complete the code to call the function greet inside main.
int main() {
[1]();
return 0;
}To call the function defined as greet, use greet();.
Fix the error in the function definition by completing the return type.
[1] greet() { std::cout << "Hello!" << std::endl; }
The function does not return a value, so its return type should be void.
Fill both blanks to create a function that adds two numbers and returns the result.
[1] add(int a, int b) { return a [2] b; }
void as return type when returning a value.- instead of addition.The function returns an integer, so the return type is int. To add two numbers, use the + operator.
Fill all three blanks to create a function that checks if a number is positive.
bool [1](int num) { if (num [2] 0) { return [3]; } else { return false; } }
The function name is isPositive. To check if a number is greater than zero, use >. If true, return true.
