Write a function print3days() that receives an integer X as its argument. X corresponds to the day in a week as follows: Day: Monday Tuesday Wednesday Thursday Friday Saturday Sunday X: 1 2 3 4 5 6 7 In the function, declare and initialize an array to hold all the above words. (b) The function uses the array to display three consecutive days starting from day X. For example if X is 6, the output should be: Saturday, Sunday, Monday (c) If X is an invalid number, display three question marks, i.e.??? (d) From within the main() function, call the above function using the values of X from 0 to

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section: Chapter Questions
Problem 4PP
icon
Related questions
Question

(a) Write a function print3days() that receives an integer X as its argument. X corresponds to the day in a week as follows: Day: Monday Tuesday Wednesday Thursday Friday Saturday Sunday X: 1 2 3 4 5 6 7 In the function, declare and initialize an array to hold all the above words. (b) The function uses the array to display three consecutive days starting from day X. For example if X is 6, the output should be: Saturday, Sunday, Monday (c) If X is an invalid number, display three question marks, i.e.??? (d) From within the main() function, call the above function using the values of X from 0 to 9.

(a) Write a function print3days( ) that receives an integer X as its
argument. X corresponds to the day in a week as follows:
Day: Monday Tuesday Wednesday Thursday Friday Saturday Sunday
X:
1
2
3
4
5
6
7
In the function, declare and initialize an array to hold all the above
words.
(b) The function uses the array to display three consecutive days starting
from day X. For example if X is 6, the output should be:
Saturday, Sunday, Monday
(c) If X is an invalid number, display three question marks, i.e. ???
(d) From within the main() function, call the above function using the values
of X from 0 to 9.
Transcribed Image Text:(a) Write a function print3days( ) that receives an integer X as its argument. X corresponds to the day in a week as follows: Day: Monday Tuesday Wednesday Thursday Friday Saturday Sunday X: 1 2 3 4 5 6 7 In the function, declare and initialize an array to hold all the above words. (b) The function uses the array to display three consecutive days starting from day X. For example if X is 6, the output should be: Saturday, Sunday, Monday (c) If X is an invalid number, display three question marks, i.e. ??? (d) From within the main() function, call the above function using the values of X from 0 to 9.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning