| |||||
Problem 01 | |||||
|
Type in the
Hello World
program, compile it, and run it. Nothing to write here for this problem.
| |||||
Problem 02 | |||||
Write a program that prints:
Do not use any escape codes.
| |||||
Problem 03 | |||||
Rewrite the program you just wrote so that it has only one statement
inside main. (Recall that this is not really recommended programming style at this level, but is useful to know how to do later on in your career.) We can solve this in two ways. We can do it in one statement, with only a single string literal, as in:
We can also break the string up into three substrings that get added together, but still in a single statement. This is visually a little easier to follow:
| |||||
Problem 04 | |||||
Write a program that prints the text:
| |||||
Problem 05 | |||||
Write a program that prints:
where the last number is the result of doing the appropriate computation, rather than a string or numeric literal appearing in the program.
| |||||
Last modified August 28 for Fall 99 cs5 by fleck@cs.hmc.edu
This page copyright ©1998 by Joshua S. Hodas. It was built with Frontier on a Macintosh . Last rebuilt on Sat, Sep 19, 1998 at 5:53:22 PM. | |
http://www.cs.hmc.edu/~hodas/courses/cs5/week_02/labsolutions.html | |