c++ functions

C++
  // Create a function
void myFunction() {
  
  cout << "I just got executed!";
}

int main() {
  
  myFunction(); // call the function
  return 0;
}

// Outputs 
  "I just got executed!"

  // function example
#include <iostream>
using namespace std;

int addition (int a, int b)
{
  int r;
  r=a+b;
  return r;
}
Source

Also in C++: