USER BUILT FUNCTIONS can't figure it out.

I am trying to write some code that basically has two user built functions. One function called "callMidNum" that asks the user for three numbers, next you have another functioned lets called "lilMiddleNum" that calculates what the middle number is but I can't seem to get my head around the logic. I have some code already but could anyone give me tips if its not correct. Thanks.

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
#include <iostream>
using namespace std;

int lilMiddleNum()
{

}

int callMidNum(int num1, int num2, int num3)
{
	for (int x=1; x<=3; x++)
	{
		cout << "Enter value 1: ";
		cin >> num1;
		cout << "Enter value 2: ";
		cin >> num2;
		cout << "Enter value 3: ";
		cin >> num2;

		numVal = middle();
	}
}
	

// Do not change anything below here
int main()
{
	int mid1, mid2, mid3;

	cout << "Enter data set one..." << endl;
	mid1 = lilMiddleNum();
	cout << "Enter data set two..." << endl;
	mid2 = lilMiddleNum();
	cout << "Enter data set three..." << endl;
	mid3 = lilMiddleNum();
	int answer = lilMiddleNum(mid1, mid2, mid3);
	cout << "The middle of the middles is " << answer << endl;
}
Last edited on
int callMidNum
The function promises to return and integer, and your code has not returned anything.

numVal= middle();
The function and numVal type is undefined.
Last edited on
Topic archived. No new replies allowed.