problem with function declaration

closed account (STp4izwU)
why in line 4 my compiler shows me this error "too few arguments to function `int add(int, int)???" here's my code:

#include <iostream>
using namespace std;

int add (int, int);


int main ()
{

cout << add ();
cin.get();

}

int add (int a=8, int b=9)
{
return (a+b);
}


The compiiler does not the degault arguments. Exchange the parameter lists in the declaration and the definition the following way

1
2
3
4
5
6
7
int add (int = 8, int = 9 );
...
...
int add (int a, int b)
{ 
   return (a+b);
}

closed account (STp4izwU)
spasibaaa )))))
Topic archived. No new replies allowed.