// fdemo2.cpp: The function fun, called in main, is declared
// before and defined after main
#include <iostream>
using namespace std;

float fun(float x, float y, int i, int j); // declaration

int main() {
 int ii, jj;
 float xx, yy;
 cout << "Enter teo real numbers followed by two integers:\n";
 cin >> xx >> yy >> ii >> jj;
 cout << "Value returned by function: "
      << fun(xx, yy, ii, jj) << endl;
 return 0;
}

float fun(float x, float y, int i, int j) {
 float a = x - y;
 int b = i - j;
 return b != 0 ? a/b : a > 0 ? +1e20 : a < 0 ? -1e20 : 0.0;
}
