Announcements
|
|
This unit deals
with branching in procedures. Depending on the outcome of a logical
condition we may want our program to follow one of two paths and in some
cases one of several paths. This is accomplished by the use of if
statements and switch statements.
In addition, in this unit, we will learn how to read from user
supplied data files and how to create such files, and we will discuss the
mathematical library functions available in C++ and the methods of their
usage.
|
|
|
Reading
Assignments
|
|
Mandatory: Book 1 Pages 116 - 119 & 71- 105
|
|
|
|
Subtopics — Notes/
Examples:
|
|
|
Tasks:
|
- Write and execute a program which prompts for and reads
the radius of the base and the height of a circular cylinder
, calculates and prints to the screen the volume and total
surface area of the cylinder ( no need to submit this work).
- Write and execute a program which prompts for and reads 3
numbers a,b,c and
prints to the screen only the positive ones ( no need to submit this
work).
- Write and execute a program which prompts for and reads a
number x, calculates y according to the rule y = 4/3 x for positive x,
and y = -0.5 x for negative x. It prints out to the screen x and y
with labels, and in addition prints the result to a file called
valuespos.txt if x>0 but to a file valuesneg.txt if x <0. ( no need to submit this work). The answer
- Start working on HW2 and 2PA
|
|
|
|
|
|
Jacob Y. Kazakia
© 2001 All rights reserved
|