December 2013
Beginner
656 pages
16h 42m
English
EXPLORATION 47
![]()
Project 2: Fixed-Point Numbers
Your task for Project 2 is to implement a simple fixed-point number class. The class represents fixed-point numbers using an integer type. The number of places after the decimal point is a fixed constant, four. For example, represent the number 3.1415 as the integer 31415 and 3.14 as 31400. You must overload the arithmetic, comparison, and I/O operators to maintain the fixed-point fiction.
Name the class fixed. It should have the following public members:
value_type
A typedef for the underlying integer type, such as int or long. By using the value_type typedef throughout the fixed class, you can easily ...
Read now
Unlock full access