vendredi 2 novembre 2018

**beginner/Student Question** cannot initialize return object of type 'int' with an lvalue of type 'int (int, int)'

#include <iostream>
using namespace std;

//below this line ***
int myMin(int num1, int num2)
{
    min(num1, num2);
    return myMin;
}
// above this line ***

int main()
{
    cout << myMin(4, 8) << endl;
    cout << myMin(6, 3) << endl;
    cout << myMin(-2, -4) << endl;
}

This is a homework assignment for school. I don't understand the error that is arising from my code.

We are only allowed to manipulate the code between the two indicated lines. It must allow the;

int main()

function to call to our created function (in this case):

int myMin(int num1, int num2)

to display the correct lowest number. I keep receiving the error "cannot initialize return object of type 'int' with an lvalue of type 'int (int, int)'."

Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire