I'm really confused because I can't describe my question well, but I'm sure that many of you will understand me.
#include <iostream>
using namespace std;
void display(int n = 1, char c = '*');
int main()
{
display();
display(5);
display('$');
return 0;
}
void display(int n, char c)
{
for (int i = 1; i <= n; i++)
cout << c;
cout << endl;
}
At display('$')
, I want to pass this char
to its parameter c
and use n
with its default value, which is 1. Can anyone tell me how to do this properly?