DANVILLE
AREA
COMMUNITY COLLEGE
INTRODUCTION TO COMPUTER SCIENCE
MATH 110, Fall
2008
Homework 3 (Due
Sept. 18
in class)
Read: Section 2.3,
2.4, 2.5,
2.6, 2.7, 2.8, 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17,
2.18,
2.19, 2.20, 2.21;
Pay special attention on 2.5, 2.6, 2.7, 2.11, 2.12, 2.13, 2.14, 2.15,
2.16,
2.17, 2.18, 2.19;
Understand the 12 examples in Chapter 2 by compiling and running them.
Solve the following Problems:
Problem
(2-32):
(p. 151);
Problem
(2-50):
(p. 154);
Problem
(2-54):
(p. 155).
Hint: (you don't have to follow
this hint if you can solve these problems)
Exercise 2.32:
***Use "while" statement, such
as: while
( multiple *= 2 )***
(1) Read Section 2.14 and 2.15..
(2) Run fig02_09.cpp on page 77.
(3) Understand the 3 lines of code on page
69.
(4) Understand the fig. 2.5 on top of 70.
(5) This problem needs only about 5
lines.
Exercise 2.50:
(1) Read Section 2.16.
(2) Run fig02_22.cpp on page 98.
(3) After understand this example
completely then modify
fig02_22.cpp to complete is this problem.
Exercise 2.54:
To learn some thing beyond the first 5
chapters, try
following things:
(1) Study Fig14_04.cpp, print your output
into a file
named as "hw2-54.dat" instead of printing you output
on
the screen.
(2) If you do not have time to study
Fig14_04.cpp, you
may type this to run your program
"hw2-54.exe
>
c:\yourfolder_name\test.txt", which will save your output on the
screen. to a file named
test.txt. DO NOT print hundreds page to answer questions of
2.54.
(3) After you got a dependent program, then
try to answer
all the questions of 2.54.
(4) Study Fig02_09cpp, and make your output
has at least
10 digits after the decimal point. And then test
the limit
of your computer. (which means in a reasonable run time, i.e.
less
then 5 minutes, how many
terms your
computer can calculate? With that many terms, what is
your best Pi you can get from your
computer by
using this method?)
Exam-2 on Oct. 9 (covers Chapter 2 and
3).