All pastes #937699 Raw Edit

float calculator

public cpp v1 · immutable
·published 2008-03-11 03:40 UTC
rendered paste body
#include<iostream>using namespace std;float add (float a, float b) {      float c = 0;      c = a + b;      return c;}float subtract (float a, float b) {      float c = 0;      c = a - b;      return c;}float multiply (float a, float b) {      float c = 0;      c = a * b;      return c;}float divide (float a, float b) {      float c = 0;      c = a / b;      return c;}int main () {    float a, b, c, decision;        cin >> a;    cout << "\n";    cin >> b;    cout << "\n";        cout << "(1) +, (2) -, (3) *, (4) /.....?" << "\n";    cin >> decision;        if (decision == 1) { c = add(a,b); };    if (decision == 2) { c = subtract(a,b); };    if (decision == 3) { c = multiply(a,b); };    if (decision == 4) { c = divide(a,b); };    cout << "End value:" << c;     system("PAUSE");    return EXIT_SUCCESS;}