This function should take as it's arguments two integer values. The function should return the smaller of the two values. From main ask the user for two integer values. Pass the two values to your smallest function, then print out the returned value.
I am new to c++ and struggling with functions. I have written the following program but can not figure out where I'm going wrong please help with any explinations to help me better understand:
#include <iostream>
using namespace std;
int getInt();
int smallNum;
int main()
{
int z;
z = getInt();
int smallerNum = smallNum(z);
cout<<"the smaller number is "<<smallerNum<<endl;
return 0;
}
int getInt()
{
int x,y;
num=(x,y);
cout<<"please input two numbers, I will tell you which number is smaller"<<endl;
cin>>x>>y;
return x,y;
}
int smallNum
{
return (x>y?small=y:small=x);
}