We all know that 1 + 1 = 2 and 1 + 1 + 1 = 3.
Also 1/3 + 1/3 + 1/3 is 3/3 or 1.
The following computer program demonstrates this. But for some reason it doesn't work. Why?
1 /************************************************
2 * test out basic arithmetic that we learned in *
3 * first grade. *
4 ************************************************/
5 #include <iostream>
6
7 int main()
8 {
9 float third = 1.0 / 3.0; // The value 1/3
10 float one = 1.0; // The value 1
11
12 if ((third+third+third) == one)
13 {
14 std::cout <<
15 "Equal 1 = 1/3 + 1/3 + 1/3\n";
16 }
17 else
18 {
19 std::cout <<
20 "NOT EQUAL 1 != 1/3 + 1/3 + 1/3\n";
21 }
22 return (0);
23 }