Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description (It has to be in C++) ALSO I CAN'T USE ARRAYS OR VECTOR THANK YOU. The purpose of this challenge is to employ the

Description (It has to be in C++)

ALSO I CAN'T USE ARRAYS OR VECTOR THANK YOU.

The purpose of this challenge is to employ the use of basic functions. This challenge will display the lyrics to the Twelve Days of Christmas.

Do Not Use

Arrays or Vectors

Requirements

  1. You may have heard the classic Christmas song that goes like this:
     On the 1st day of Christmas, My true love gave to me, A partridge in a pear tree. On the 2nd day of Christmas, My true love gave to me, 2 turtle doves, And a partridge in a pear tree. On the 3rd day of Christmas, My true love gave to me, 3 french hens, 2 turtle doves, And a partridge in a pear tree. On the 4th day of Christmas, My true love gave to me, 4 colly birds, 3 french hens, 2 turtle doves, And a partridge in a pear tree and so on The complete and final verse is: On the 12th day of Christmas, My true love gave to me, 12 drummers drumming, 11 pipers piping, 10 lords-a-leaping, 9 ladies dancing, 8 maids-a-milking, 7 swans-a-swimming, 6 geese-a-laying, 5 golden rings, 4 colly birds, 3 french hens, 2 turtle doves, And a partridge in a pear true. 
  2. Write a program that will display the complete lyrics of the song.
  3. The final output will display all twelve verses. Do not prompt the user to display only one verse.
  4. Create a function that will display a number with its ordinal suffix, show_ordinal(int). It will take a single integer parameter. It will output to the screen the number with its suffix. For example, if you call show_ordinal(5), it will output 5th. Remember that 11 and 12 are special cases if you choose to use modulo division by 10. Its ok to use cout in this function since thats what its supposed to do.
  5. Create a function, show_verse(int), that will display a single verse. If you pass in 3, it will display the third verse counting down from 3 french hens, down to the partridge in a pear tree. Dont forget the beginning of the verse: On the xx day of Christmas, my true love gave to me... Do not hard-code each verse in the function for display.
  6. Call the show_verse() function-from step #5 above-in a loop to display all 12 verses
  7. Remember to add a blank line after each verse
  8. Remember that the 1st verse is special in that it says and a partridge in a pear tree. There is no and.

Extra Challenge

At the start of the program, ask the user a choice of displaying numeric or descriptive words in the verse. Then based on the users choice, display the lyric.

You will have to create two new functions show_num_text(int) and show_ordinal_text(int). When this function is called as show_ordinal_text(1), it will output first instead of 1st, second instead of 2nd, and so on. show_num_text(3) will output the word three, instead of the number 3, for example.

The descriptive output of the lyric then becomes (sample excerpt below):

 On the third day of Christmas, my true love gave to me, three French hens, two turtle doves, and a partridge in a pear tree. 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

LO3.3 Describe supply and explain how it can change.

Answered: 1 week ago

Question

LO3.1 Characterize and give examples of markets.

Answered: 1 week ago