Write a C++ program which will print the lyrics to the song Bingo. The catch: th
ID: 3589378 • Letter: W
Question
Write a C++ program which will print the lyrics to the song Bingo. The catch: the name of the dog must be stored in a constant array of characters, and this array must be used every time the dog's name needs to be printed to the screen uirements: . Name the source file for your program program5.cpp . The following two declarations are required, in the global space: const int SIZE = 5 const char dog[SIZE] '''I', 'N', 'G', '0'; » Any time the word BINGO needs to be printed, even partially, it must be by accessing the array - For printing the partial name, this means that you must access the array to print the letters in BINGO . A sample run of your program should look exactly like: There was a farmer had a dog and B 1 N G 0 as his name-o BING0 BING0 BING0 And B 1 N G 0 was his name-o There was a farmer had a dog and B 1 N G 0 as his name-o ING0 ING0 ING0 And B 1 N G 0 was his name-o There was a farmer had a dog and B 1 N G 0 as his name-o N G 0 N G 0 N G 0 And B I N G 0 as his name-oExplanation / Answer
#include<iostream>
using namespace std;
const int SIZE=5;
const char dog[SIZE]={'B','I','N','G','O'};
int main()
{
//loop for 6 stanzas
for(int i=1;i<=SIZE+1;i++)
{
//printing the lyrics
cout<<"There was a farmer who had a dog,"<<endl;
cout<<"And "<<dog<<" was his name-o."<<endl;
//printing three bingow clapping rows
for(int row=1;row<4;row++)
{
//deciding loop to place a * or letter
for(int j=1;j<=SIZE;j++)
{
if(j<i)cout<<"* ";
else cout<<dog[j-1]<<" ";
}
cout<<endl;
}
cout<<"And "<<dog<<" was his name-o."<<endl<<endl;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.