im getting an error message in this simple program im practicing functions with that says "Command /Developer/usr/bin/g++-4.2 failed with exit code 1" and i have no idea whats causing it. heres my code:
Code:
#include <iostream>
using namespace std;
int add (int a, int b, int c, int d, int e);
int sub (int a, int b);
int mult (int a, int b, int c, int d, int e);
float divide (int c, int e);
int main()
{
int a;
int b;
int c;
int d;
int e;
cout<<"Please input 5 numbers. Press enter in between each number\n";
cin>>a;
cin.get();
cin>>b;
cin.get();
cin>>c;
cin.get();
cin>>d;
cin.get();
cin>>e;
cin.get();
cout<<"Your 5 numbers were: "<<a<<", "<<b<<", "<<c<<", "<<d<<" and "<<e<<".\n\n";
cout<<"The sum of your numbers is: "<< add (a, b, c, d, e) <<".\n";
cout<<"The product of your numbers is: "<< mult (a, b, c, d, e) <<".\n";
cout<<"The difference of your first 2 numbers is: " <<sub (a, b) <<".\n";
cout<<"The quotient of your 3rd and 4th numbers is: "<< divide (c, e) <<".\n\n";
cin.get();
}
int add (int a, int b, int c, int d, int e)
{
return a+b+c+d+e;
}
int sub (int a, int b)
{
return a-b;
}
int mult (int a, int b, int c, int d, int e)
{
return a*b*c*d*e;
}
float divide (int c, int e)
{
return c/e;
}