function examples C++
Example 1: how to declare a function in c++
// function example
#include <iostream>
using namespace std;
int addition (int a, int b)
{
int r;
r=a+b;
return r;
}
Example 2: function in c++
#include <iostream>
using namespace std;
void function(){
cout << "I am a function!" << endl;
}
int main()
{
function();
return 0;
}
Example 3: functions in C++
void Hello() {
std::cout << "Hello";
}
int main () {
Hello();
}