(C PROGRAMMING ONLY!) 3. Pet Lover by CodeChum Admin One of the easiest ways to make a pet lover happy is to give them very many pets! My friend, Jhelian is a pet lover and for her 21st birthday, I'm planning to give her very many Dogs. It's very timely because my pet dog just gave birth to a lot of cuties! So I don't really need to buy. All I need is to just give these cute little fur babies to her. Instructions: In the code editor, you are provided with the definition of a struct Dog. This struct needs a character value for its gender, which could either be 'm' for a male Dog or 'f' for a female Dog. Furthermore, an array of Dogs has already been created an each of their genders has been set. Then, on line 16, a call to the function giveDogs() was made where the dogs array was passed. Your task is to implement this giveDogs() function which has the following details: Return type - void Name - giveDogs Parameters a pointer/holder of a Dogs array size of the Dogs array Description - loops through the Dogs array and prints the correct message (refer to the sample output) Output Note that the dog number starts at 1, not 0. Dog #1 (gender = m) Dog #2 (gender = f) Dog #3 (gender = m) Dog #4 (gender = f) Dog #5 (gender = m) Dog #6 (gender = f) Dog #7 (gender = m) Dog #8 (gender = f) Dog #9 (gender = m) Dog #10 (gender = f) Dog #11 (gender = m) Dog #12 (gender = f) Dog #13 (gender = m)
(C PROGRAMMING ONLY!)
3. Pet Lover
by CodeChum Admin
One of the easiest ways to make a pet lover happy is to give them very many pets!
My friend, Jhelian is a pet lover and for her 21st birthday, I'm planning to give her very many Dogs. It's very timely because my pet dog just gave birth to a lot of cuties!
So I don't really need to buy. All I need is to just give these cute little fur babies to her.
Instructions:
In the code editor, you are provided with the definition of a struct Dog. This struct needs a character value for its gender, which could either be 'm' for a male Dog or 'f' for a female Dog.
Furthermore, an array of Dogs has already been created an each of their genders has been set. Then, on line 16, a call to the function giveDogs() was made where the dogs array was passed.
Your task is to implement this giveDogs() function which has the following details:
Return type - void
Name - giveDogs
Parameters
a pointer/holder of a Dogs array
size of the Dogs array
Description - loops through the Dogs array and prints the correct message (refer to the sample output)
Output
Note that the dog number starts at 1, not 0.
Dog #1 (gender = m)
Dog #2 (gender = f)
Dog #3 (gender = m)
Dog #4 (gender = f)
Dog #5 (gender = m)
Dog #6 (gender = f)
Dog #7 (gender = m)
Dog #8 (gender = f)
Dog #9 (gender = m)
Dog #10 (gender = f)
Dog #11 (gender = m)
Dog #12 (gender = f)
Dog #13 (gender = m)
.
.
.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images