How effective is it to default to user input in C++ function parameters? This defaults to user input if the arguments are not passed at compile time.. How effective is this technique and where can it be applied?

#define _CRT_SECURE_NO_WARNINGS
#include &lt;iostream&gt;

void foo(unsigned number = []() {unsigned num = 0; std::cin &gt;&gt; num; return num; } ()) {
    std::cout &lt;&lt; number &lt;&lt; "\n";
}


int main() {
    foo(1); //prints 1
    foo();  //defaults to user input    
    return 0;
}
I haven't seen this pattern in use, and I wouldn't use it personally, for two reasons:

1) Unintuitive - Changing the function's behavior in this significant of a way is not something you'd expect from the default value of a parameter.

2) Mixing Concerns - It's almost always better to separate your I/O from your algorithm.

Considering that this is a compile-time difference anyway, it would be more clear to have another method to read input.  For example:

foo(1);
foo(foo_input());