Alogarithm steps:
- Start the program
- Write one function with default arguments
- Call that function in the main program
- The function be called without arguments, with single arguments, with two arguments
- Compile and run the program.
CPP Program for Functions With Default Arguments
#include
void f(int a=0, int b=0)
{
cout << "a: " << a << " b: " << b;
cout << '\n';
}
int main()
{
f ();
f (10);
f(10, 99);
return 0;
}
SAMPLE INPUT AND OUTPUT:
Function f()
a:0
b:0
Function f(10)
a:10
b:0
Function f(10,99)
a:10
b:99
|