Build errors on function?

Alright, I keep getting build errors on line 23 due to the fact that the "smallest" function does not take 2 arguments. I'm not really sure what I'm doing wrong.

Any tips?

Thank you.

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

int smallest(); // function prototype

int main()
{
int num1, num2;
int z;

	cout << "Enter two numbers and I will tell you which is the smallest." << endl;
	cin >> num1 >> num2;
	
	z = smallest(num1, num2);

	cout << z << " is the smallest." << endl;

	return 0;
} 

int smallest(int x, int y) 
{
	return (x < y ? x : y);
}
int smallest(); // function prototype
You say that your function takes no parameter

z = smallest(num1, num2);
You pass it two parameters.
Ah, I see. Thank you.
Topic archived. No new replies allowed.