write new function in main c++ code example
Example 1: functions in C++
void Hello() {
std::cout << "Hello";
}
int main () {
Hello();
}
Example 2: how to make a function in cpp
// function returning the max between two numbers
int max(int num1, int num2) {
// local variable declaration
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}