After this class, you should be able to:
string
class, including performing I/O with it.
erase
in the file usevec.cpp
with pop_back
.
n a b
. n
is an integer, while
a
and b
are floating point numbers, with
a < b
. The interval (a, b)
is divided
into n
cells of equal length. Consequently, the real
number x
in (a, b)
will fall in cell number
floor[ (x-a)/(b-a) * n]
. You should use an STL vector to
represent the interval (a, b)
, with each element of the
vector representing a cell. Each cell contains an STL list. Each list,
in turn, contains points that fall in that cell. The points, which are
floating point numbers in the interval (a, b)
, are read
from standard input, one point per line. The program reads points until it reads
EOF
(end of file, typically signaled by Control-D). For
each cell, it outputs, on a separate line, the cell number and the
points that lie in it. You may use any STL features that you wish to. You can take a look at the sample executable: ~cop4530/fall04/CodeExamples/Lec4/cells on the CS file server. A sample input is given in the file cells.input, in the same directory. You can try running: cells 5 -2.0 8.0 < cells.input
to see the output. Please do not post your solutions to this question on the discussion board. We will check your solutions during recitation.
n
positive integers is n(n+1)/2
.ax = b
, then what is logab
, when a > 1, b > 0
?
log28
?