Hello, I'm just learning to program in C++. I constructed a working multiplication function from a tutorial, and decided to make a division one, to see if I could, but the code is giving me a bit of a problem.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
usingnamespace std;
int division (int x, int y);
int main ()
{
int answer;
answer = division ( 6/2 );
cout << answer;
return 0;
}
int division ( int x, int y)
{
return x/y;
}
6/2 will resolve to 3, and thus you are only passing one argument to your function. I think you meant to pass 6 and 2 as individual arguments, which means you want a ',' between them, not a '/'.