All pastes #368119 Raw Edit

Untitled

public text v1 · immutable
#368119 ·published 2007-02-22 21:00 UTC
rendered paste body
#include <iostream.h>

int Add (int x, int y, int z, int w, int v)
{        
        return (x+y+z+w+v);
}

int Subtract (int x, int y, int z, int w, int v)
{         
        return (x-y-z-w-v);
}

int Divide (int x, int y, int z, int w, int v)
{         
        return (x/y/z/w/v);
}

int Multiply (int x, int y, int z, int w, int v)
{         
        return (x*y*z*w*v);
}

int main()
{
        int a, b, c, d, e, f, g;
        cout << "Enter five numbers: ";
        cin >> a;
        cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	cout << "\nNow choose the operation to use on these numbers:";
	cout << "\n";
	cout << "\n1. Add them";
	cout << "\n2. Subtract them";
	cout << "\n3. Divide them";
	cout << "\n4. Multiply them";
	cout << "\n";
	cout << "\nEnter the number of the operation: ";
	cin >> g;
	if(g == 1)
	{
		cout << "\nAdding...\n";
		f=Add(a, b, c, d, e);
		cout << "Answer =  " << f;
		cout << "\nExiting...\n";
		return 1;
	}
	if(g == 2)
	{
		cout << "\nSubtracting...\n";
		f=Subtract(a, b, c, d, e);
		cout << "Answer =  " << f;
		cout << "\nExiting...\n";
		return 1;
	}
	if(g == 3)
	{
		cout << "\nDividing...\n";
		f=Divide(a, b, c, d, e);
		cout << "Answer =  " << f;
		cout << "\nExiting...\n";
		return 1;
	}
	if(g == 4)
	{
		cout << "\nMultiplying...\n";
		f=Multiply(a, b, c, d, e);
		cout << "Answer =  " << f;
		cout << "\nExiting...\n";
		return 1;
	}	
	else
	{
		cout << "\nPlease choose one of the operations";
		cin >> g;
	}
	return 1;
}