I am very new to c++, and I am doing this simple homework where I need to find max and min values, it keeps giving me expected unqualified id error. Here is the code, thanks a lot.
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int min(int a, int b, int c, int d)
{
int result = a;
if (b < result) result = b;
if (c < result) result = c;
if (d < result) result = d;
return result;
}
int main()
{
int x;
x = min(2,6,3,4);
cout << " The result is " << x;
}
int max( int a, int b, int c, int d); #expected unqualified id
{
int max = a;
if (b > result) result = b;
if (c > result) result = c;
if (d > result) result = d;
return max;
}
int main1()
{
int x;
x = min(2,6,3,4);
cout << " The result is " << x;
}