4. Program that displays your favorite poem. Use an appropriate escape sequence for the line breaks.
Chapter 2:
C++ Programming Basics
Programming Exercise
Problem # 4:
Write a program that displays your favorite poem. Use an appropriate escape sequence for the line breaks. If you don't have a favorite poem, you can borrow this one by Ogden Nash:
Candy is dandy,
But liquor is quicker.
Solution:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
cout<<"\tCandy is dandy,\n\tBut liquor is quicker.\n";
return 0;
}
#include<conio.h>
using namespace std;
int main()
{
cout<<"\tCandy is dandy,\n\tBut liquor is quicker.\n";
return 0;
}
Let me know in the comment section if you have any question.
Previous Post:
3. Program that generates the following output: 10 20 19 Use an integer constant for the 10, an arithmetic assignment operator to generate the 20, and a decrement operator to generate 19.
Comments
Post a Comment