please help me solve this problem

i am trying to call some functions in my main function.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
[code]#include <iostream>
#include <math.h>

using namespace 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;
		}


	}
}




	
Last edited on
Please edit your post to put [code][/code] tags around your code (the <> format icon).
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.




Topic archived. No new replies allowed.