Pointers and Functions

All of us started from being a rookie, and I'm one of those rookies who are new in this course. Maybe its time for you
to share your expertise unto the newbies? Hope anyone might help me willingly in my program.Here's the problem:

Use Pointers and Functions:

Ask a user wether (+), (-), (*), or (/) is to be executed, After choosing the operation, ask the user how many
operands will it use. Display the correct corresponding output.

Example: Chose an Operation: *
Number of Operands: 3
Enter 1st Operand: 2
Enter 2nd Operand: 1
Enter 3rd Operand: 3
The Product is 6.

My code (Haven't got it yet):

#include <iostream>
#include <conio.h>
using namespace std;

void addition (int *b)
{
int operands, c;
cout << "Number of Operands: ";
cin >> operands;

for ( int i = 0; i < operands; i++)
{
cout << "Enter " << i+1 << " Operand: ";
cin >> *b;
*b = *b + *b;
}
}


void subtraction (int *b)
{
int c, d, e;
cout << "Enter 1st Operand: ";
cin >> c;
cout << "Enter 2nd Operand: ";
cin >> d;
cout << "Enter 3rd Operand: ";
cin >> e;
*b = c - d - e;
}

void multiplication (int *b)
{
int c, d, e;
cout << "Enter 1st Operand: ";
cin >> c;
cout << "Enter 2nd Operand: ";
cin >> d;
cout << "Enter 3rd Operand: ";
cin >> e;
*b = c * d * e;
}

void division (int *b)
{
int c, d, e;
cout << "Enter 1st Operand: ";
cin >> c;
cout << "Enter 2nd Operand: ";
cin >> d;
cout << "Enter 3rd Operand: ";
cin >> e;
*b = c / d / e;
}

int main ()
{
char input = 0;
int a;

cout << "Choose an Operation: ";
cin >> input;


if (input == '+')
{
addition (&a);
cout << a;
}

else if (input == '-')
{
subtraction (&a);
cout << a;
}

else if (input == '*')
{
multiplication (&a);
cout << a;
}

else if (input == '/')
{
division (&a);
cout << a;
}

else
{
cout << "Not in the choices. ";
}

getch ();
return 0;
}


Hoping that anyone with a kind heart would willingly help me. Good day and thanks in advance. :)
Firstly, please could you put your code in code tags, to make it easier to read?

http://www.cplusplus.com/articles/z13hAqkS/

Secondly, you haven't been very clear about what your problem actually is. What, specifically, are you having difficulty with?
Topic archived. No new replies allowed.