[code]#include <iostream>
#include <math.h>
usingnamespace std;
int a = 1;
double x;
double y;
int c;
double sum;
int z;
int u;
int q;
int w;
int r;
int e;
int der1 = q * e;
int der2 = e - 1;
int der3 = w *r;
int der4 = r - 1;
int multip()
{
cout << "please chose a number to multiply" << endl;
cin >> x;
cout << "the other number too" << endl;
cin >> y;
sum = x * y;
cout << "the result is " << sum << endl;
return 0;
}
int division()
{
cout << "please chose a number to divide" << endl;
cin >> x;
cout << "pleas decide a number to divide by" << endl;
cin >> y;
sum = x / y;
cout << "the result is " << sum << endl;
return 0;
}
int sub()
{
cout << "please chose a number to subtract" << endl;
cin >> x;
cout << "pleas decide a number to subtract by" << endl;
cin >> y;
sum = x - y;
cout << "the result is " << sum << endl;
return 0;
}
int add()
{
cout << "please chose a number to add" << endl;
cin >> x;
cout << "pleas decide a number to add by" << endl;
cin >> y;
sum = x + y;
cout << "the result is " << sum << endl;
return 0;
}
int root()
{
cout << "please chose a number to square root" << endl;
cin >> x;
sum = sqrt(x);
cout << "the result is " << sum << endl;
return 0;
}
int log()
{
cout << "please chose a number to log (natural log)" << endl;
cin >> x;
sum = log10(x);
cout << "the result is " << sum << endl;
return 0;
}
int expo()
{
cout << "please chose a base" << endl;
cin >> x;
cout << "please chose a exponent" << endl;
cin >> y;
sum = pow(x, y);
cout << "the result is " << sum << endl;
return 0;
}
int main()
{
while (a <= 1)
{
cout << "please chose an operation: for mult. put 1, for dev but 2 for sub put 3, for addition put 4, square root is 5, log is 6, exponents is 7, enter 8 for derivative" << endl;
cin >> c;
if (c == 8) {
cout << "press 1 for product" << endl;
cin >> u;
// multiplication
if (u == 1)
{
// v'
cout << "for product enter it in the form of ax^n" << endl;
cout << "first enter a then enter n" << endl;
cin >> q;
cin >> e;
//u'
cout << "now enter the second equation in the same format" << endl;
cin >> w;
cin >> r;
cout << "the derivative is: (" << q << "x^" << e << ")" << der3 << "x^" << der4 << "+(" << w << "x^" << r << ")" << der1 << "x^" << der2 << endl;
}
}
if (c == 2)
{
int division();
}
if (c == 1)
{
int multip();
}
if (c == 3)
{
int sub();
}
if (c == 4)
{
int add();
if (c == 5)
{
int root();
}
if (c == 6)
{
int log();
}
if (c == 7)
{
int expo();
}
cout << "Press 1 followed by enter to begin the calculator, or enter 2 to end" << endl;
cin >> a;
}
}
}
Two problems:
Lines 73, 78, 83, 88: When you call a function you need ().
Same lines: When you call a function, the compiler must know how to call that function. If the functions definitions are after the call, you need function prototypes:
21 22 23 24 25
int multip();
void division();
void sub();
void add();
void root();
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.