Nathan K.
8
Q:

functions in C++

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

int addition (int a, int b)
{
  int r;
  r=a+b;
  return r;
}
9
#include <iostream>

using namespace std;

void function(){
    cout << "I am a function!" << endl;
}

int main()
{
    function();

    return 0;
}
1
void Hello() {
  std::cout << "Hello";
}

int main () {
  Hello();
}
2
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <fstream>
using namespace std;

void function_one(double, double, double);

int main() {
  double r1 = 1.0;
  double r2 = 2.0;
  double x = 0.0;
  function_one(r1, r2, x);
  return 0;
}

void function_one(double rmin, double rmax, double x0) {
  cout << "Function got called" << endl;
}
0

New to Communities?

Join the community