logo CodeStepByStep logo

taJustSmiled

Write a complete program that prints the following cumulative song as console output. Use functions to capture the structure of the song and to eliminate redundancy. For example, no complete line of output should be println'd in two or more places in your code.

I once wrote a program that wouldn't compile
I don't know why it wouldn't compile,
My TA just smiled.

My program did nothing
So I started typing.
I added a cout << "I <3 coding",
I don't know why it wouldn't compile,
My TA just smiled.

"Parse error," cried the compiler
Luckily I'm such a code baller.
I added a backslash to escape the quotes,
I added a cout << "I <3 coding",
I don't know why it wouldn't compile,
My TA just smiled.

Now the compiler wanted an identifier
And I thought the situation was getting dire.
I added a main to make it function,
I added a backslash to escape the quotes,
I added a cout << "I <3 coding",
I don't know why it wouldn't compile,
My TA just smiled.

C++ complained it expected an enum
Boy, these computers really are dumb!
I added a function and called it scum(),
I added a main to make it function,
I added a backslash to escape the quotes,
I added a cout << "I <3 coding",
I don't know why it wouldn't compile,
My TA just smiled.
Function: Write a C++ function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.