0
write a program to define a function with default argument. whenever the function needs default values of arguments,it should prompt the user to enter the default value. also display the default values.
we can create any function
5 ответов
0
void f(int v = NULL) {
if (!v && v != 0) {
cout << "Argument needed: ";
cin >> v;
}
cout << v;
}
EDIT:
Now it satisfies your last requirement.
0
thank you bro
0
Anyways, i have to ask, what is the purpose of this piece of code? It is supposed that the default values in functions are for exactly this purpose, so you dont have to write it, so, what is his purpose?
0
this the program given to me as an assignment in my university I was getting the logic but not able to write the code so I posted it that its
0
ntng more than that