Lab 1 - My first C Program
September 19 is International Talk Like a pirate Day
http://www.talklikeapirate.com/piratehome.html
Your first lab will be in honor of this day. Make sure that you spend the day "talking like a pirate!!".
Part I - Type in the following C++ programs that we went over during lecture.
// File simple2.cpp
// Description: Displays Avast me hearties, land ho!
// Programmer: Insert your name here
// Date: Insert
today's date
#include
<iostream>
using namespace std;
int
main()
{
cout << "Avast me hearties,
";
cout << "land ho!\n";
return 0;
}
Part II - Modify the above program so that each cout statement prints on two separate lines. The output should look like:
Avast me hearties,
land ho!
Part III - Modify the program so that the output is the same as in Part II but the program has only one cout statement.
Part IV - Write a C++ program that prints the following limerick. Use only escape sequences to indicate the tab indents.
There once was a pirate from spank,
Who tried to make a wench walk the plank,
But me lady he said,
"Would you like rum instead?"
So they went off and
shared a whole tank.
Part V - Write a C++ program that
1) declares an integer variable, a float variable and a character variable
2) assigns the values 5, 234.67, and q to each of these variables respectively
3) Prints the following statement:
5
234.67
The
letter is:
q