[ create a new paste ] login | about

Link: http://codepad.org/KLbGWgL6    [ raw code | output | fork ]

C++, pasted on Oct 12:
#include <iostream>
using namespace std;

void calc(double a, double b, double &s, double &d, double &p, double &q) {
  s = a + b;
  d = a - b;
  p = a * b;
  q = a / b;
}

int main() {
  double a, b, s, d, p, q;

  cout << "a = ";
  cin >> a;
  cout << "b = ";
  cin >> b;

  calc(a, b, s, d, p, q);

  cout << "a + b = " << s << endl;
  cout << "a - b = " << d << endl;
  cout << "a * b = " << p << endl;
  cout << "a / b = " << q << endl;
  return 0;
}
/* end */


Output:
1
2
3
4
a = b = a + b = 4.947e-270
a - b = -4.947e-270
a * b = 0
a / b = 1.34367e-46


Create a new paste based on this one


Comments: