|CSC 161||Grinnell College||Spring, 2010|
|Imperative Problem Solving and Data Structures|
This laboratory exercise provides practice with conditional (if) constructs in C.
When you started C in this course, we introduced the the Emacs Text Editor. In this lab, you are asked to use the the VIM editor for your work.
After this lab, you are free to use whatever editor you wish for writing your C programs. However, you are strongly encouraged to use either emacs or VIM, since these have powerful capabilities that can help with C programming.
Do King, Exercise 5.1 (page 93).
Do King, Exercise 5.3 (page 94).
Do King, Exercise 5.5 (page 94). (Be sure you can explain your answer!)
Do King, Programming Project 5.5 (page 96).
Do King, Programming Project 5.9 (page 97).
[This problem is based on an exercise by Darrah Chavey, Beloit College.]
Write a C program that reads the lengths of three sides of a triangle and prints out the classification of the triangle as follows:
In this problem, you should assume that the input values are all numbers, although error checking may indicate some numbers are negative or zero.
(Challenge Problem — Optional)
A Baby Sitting Problem: A baby sitter charges $1.50 per hour until 9:00 pm (while the kids are still up), $1.00 per hour between 9:00 pm and midnight, and $1.25 per hour after midnight (since late night baby sitting interferes with morning classes).
Write a program that reads the sitter's starting time in hours and minutes and the ending time in hours and minutes and then computes the sitter's fee. Assume all times are between 6:00 pm and 6:00 am, and hours should be entered as being between 0 and 12 (inclusive). Hours outside the range of 0 to 12 should be considered invalid.
The following table may clarify allowed time values for this problem.
This document is available on the World Wide Web as
created 31 August 1998
last revised 6 February 2010
|For more information, please contact Henry M. Walker at firstname.lastname@example.org.|