So essentially, I have created a function that has 3 parameters and it adds the total amount of all 3 of the arguments passed to it and then prints an asterisk for each number until the total has been reached. An example of the function call would be:
stars(6, 1, 4);
and the output is just 11 asterisks on the same line. So basically, it adds up all the arguments, and then loops through, printing an asterisk for each iteration of the loop. Now, I also want to be able to call it in my main() like this:
stars(2, 5);
but every time I call it with only 2 arguments, I get an error stating that there are too few arguments to function 'void stars(int, int, int)'. I have no clue how to go about this honestly, and would love to be pointed in the right direction so I can solve this. Thanks! Btw, my function looks like this:
void stars(int arg1, int arg2, int arg3){
int total = arg1 + arg2 + arg3;
for (int i = 0; i < total; i++) {
cout << "*";
}
cout << "\n";
}